Skip to content

Instantly share code, notes, and snippets.

@zagriyen
zagriyen / wp-remove-gutenberg-block-library-css.php
Created August 24, 2022 22:55 — forked from someguy9/wp-remove-gutenberg-block-library-css.php
Removed the "/wp-includes/css/dist/block-library/style.min.css" file from your WordPress site
<?php
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-blocks-style' ); // Remove WooCommerce block CSS
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css', 100 );
@zagriyen
zagriyen / detect-pardot-editor-simple.html
Created December 10, 2020 15:43 — forked from interactiveRob/detect-pardot-editor-simple.html
Simple pardot detect iframe add class to body
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function () {
function isIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
@zagriyen
zagriyen / preventNonBusinessEmailSubmission.js
Created June 22, 2018 13:22 — forked from MurtzaM/preventNonBusinessEmailSubmission.js
This script will prevent Marketo form submission if a user enters a non-business email (Gmail, Hotmail, etc.)
//This script prevents Marketo form submission if a user enters non-business email (Gmail, Hotmail, Yahoo, etc.)
//It will work on any page with a Marketo form, and runs when the form is ready
//For further info, please see Marketo form documentation, http://developers.marketo.com/documentation/websites/forms-2-0/
//Prepared by Ian Taylor and Murtza Manzur on 9/9/2014
<script>
(function (){
// Please include the email domains you would like to block in this list
var invalidDomains = ["@gmail.","@yahoo.","@hotmail.","@live.","@aol.","@outlook."];
@zagriyen
zagriyen / chartjs-plgn.js
Created November 6, 2017 09:18
Canvas background color Chartjs
Chart.plugins.register({
beforeDraw: function(chartInstance) {
var ctx = chartInstance.chart.ctx;
ctx.fillStyle = "white";
ctx.fillRect(0, 0, chartInstance.chart.width, chartInstance.chart.height);
}
});
@zagriyen
zagriyen / ICS.php
Created July 19, 2017 10:28 — forked from jakebellacera/ICS.php
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* ICS.php
* =======
* Use this class to create an .ics file.
*
* Usage
* -----
* Basic usage - generate ics file contents (see below for available properties):
@zagriyen
zagriyen / js.js
Created March 31, 2017 04:16 — forked from GaryJones/js.js
Gravity Forms Countries dropdown with country codes
var countryCodes = {
'Afghanistan': '93',
'Albania': '355',
'Algeria': '213',
'American Samoa': '684',
'Andorra': '376',
'Angola': '244',
'Antigua and Barbuda': '1-268',
'Argentina': '54',
'Armenia': '374',
@zagriyen
zagriyen / gw-gravity-forms-minimum-characters.php
Created March 31, 2017 04:15 — forked from spivurno/gw-gravity-forms-minimum-characters.php
Gravity Wiz // Require Minimum Character Limit for Gravity Forms
<?php
/**
* Gravity Wiz // Require Minimum Character Limit for Gravity Forms
*
* Adds support for requiring a minimum number of characters for text-based Gravity Form fields.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/...
@zagriyen
zagriyen / dns-subdomain-gandi-mailgun.txt
Last active October 18, 2018 15:13 — forked from luanshiliuxng/dns-subdomain-gandi-mailgun.txt
Gandi subdomain DNS configuration for Mailgun validation
# Gandi subdomain DNS configuration for Mailgun validation
# - Add the SPF record as TXT and SPF
# - Suffix the DKIM record and `email` CNAME with the subdomain
# ex: `mg.domain.com`
mg 10800 IN CNAME mailgun.org.
@ 10800 IN SPF "v=spf1 include:mailgun.org ~all"
@ 10800 IN TXT "v=spf1 include:mailgun.org ~all"
krs._domainkey.mg 10800 IN TXT "k=rsa; p=MIG...QAB"
email.mg 10800 IN CNAME mailgun.org.
@ 10800 IN MX 10 mxa.mailgun.org.
<?php
// Create a new Query
$args = array(
'post_type' => 'post',
'cat' => '1,6,8',
'author_name' => 'john',
'posts_per_page' => 5,
'fields' => 'ids'
);
/***
* Gravity Forms: Validate to ensure date fields are not the same or todays date
*
* This will validate the fields on form submission and return a validation error on the fields in question.
* In this case it validates an Arrival and Departure date against each other and today's date.
*
* Code goes in your theme's functions.php file.
***/
add_filter('gform_field_validation','validate_dates',10,4);