Skip to content

Instantly share code, notes, and snippets.

@intelliweb
intelliweb / mjml-api-invalid-json-request
Created October 22, 2019 19:33
MJML issue #1736: API sometimes returns invalid JSON
{"mjml":"<mjml><mj-head><mj-preview>%FIRSTNAME%, are you and %SPOUSE_FIRSTNAME% today's giveaway winners?<\/mj-preview><mj-attributes><mj-all font-family=\"Arial, Helvetica, sans-serif\" align=\"center\" \/><mj-button background-color=\"#55aaa4\" border=\"1px solid #499e98\" font-size=\"18px\" \/><mj-text color=\"#555555\" font-size=\"16px\" \/><mj-class name=\"footer-text\" align=\"center\" color=\"#AAAAAA\" font-size=\"11px\" line-height=\"13px\" \/><\/mj-attributes><\/mj-head> <mj-body><mj-section padding=\"0\"><mj-column><mj-image src=\"https:\/\/weddingvibe.com\/images\/email\/wv\/WV-Winner-Announced-header.jpg\" alt=\"WeddingVibe Giveaway Winner Announced\" title=\"WeddingVibe Giveaway Winner Announced\" align=\"center\" width=\"600px\" padding=\"10px 0\"><\/mj-image><\/mj-column><\/mj-section><mj-section padding-top=\"0\"><mj-column><mj-text>Check our Giveaway Winners page to see if you are the winner of...<\/mj-text><mj-text font-size=\"24px\" padding-bottom=\"5px\">Wedding Speech Help<\/mj-text><mj-
@intelliweb
intelliweb / mjml-api-invalid-json-request
Created October 22, 2019 19:33
MJML issue #1736: API sometimes returns invalid JSON
{"mjml":"<mjml><mj-head><mj-preview>%FIRSTNAME%, are you and %SPOUSE_FIRSTNAME% today's giveaway winners?<\/mj-preview><mj-attributes><mj-all font-family=\"Arial, Helvetica, sans-serif\" align=\"center\" \/><mj-button background-color=\"#55aaa4\" border=\"1px solid #499e98\" font-size=\"18px\" \/><mj-text color=\"#555555\" font-size=\"16px\" \/><mj-class name=\"footer-text\" align=\"center\" color=\"#AAAAAA\" font-size=\"11px\" line-height=\"13px\" \/><\/mj-attributes><\/mj-head> <mj-body><mj-section padding=\"0\"><mj-column><mj-image src=\"https:\/\/weddingvibe.com\/images\/email\/wv\/WV-Winner-Announced-header.jpg\" alt=\"WeddingVibe Giveaway Winner Announced\" title=\"WeddingVibe Giveaway Winner Announced\" align=\"center\" width=\"600px\" padding=\"10px 0\"><\/mj-image><\/mj-column><\/mj-section><mj-section padding-top=\"0\"><mj-column><mj-text>Check our Giveaway Winners page to see if you are the winner of...<\/mj-text><mj-text font-size=\"24px\" padding-bottom=\"5px\">Wedding Speech Help<\/mj-text><mj-
@intelliweb
intelliweb / CSS_filter_effects.md
Last active November 4, 2016 19:51
CSS Filter Effects

##Browser Compatibility

CSS filters are not currently supported in all browsers:

http://caniuse.com/#search=filters

For cross-browser compatibility, the image needs to be modified and uploaded in final form. CSS filters do, however, allow for quick testing of different filtering combos before editing an image with photo-editing software.

##Resources

@intelliweb
intelliweb / remove_gf_admin_menu.php
Created December 12, 2014 03:45
GF: Remove admin menu item by user capability. Be sure to add custom capability first!
<?php
// Be sure to add custom capability first!
// Remove GF menu for anyone not having custom capability
add_action('admin_menu', 'intw_remove_gf_menus', 999);
function intw_remove_gf_menus() {
if( !current_user_can('gravityforms_full_access') ) {
remove_menu_page( 'gf_edit_forms' );
}
}
@intelliweb
intelliweb / disable_admin_bar_search.php
Created October 2, 2014 15:18
WP: The search form in the admin bar can cause a security warning over HTTPS (SSL). This snippet disables the search form in the admin bar.
<?php
// Disable search icon and input in admin bar
add_action( 'wp_before_admin_bar_render', 'intw_disable_admin_bar_search' );
function intw_disable_admin_bar_search() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('search');
}
@intelliweb
intelliweb / custom_string_length.php
Created August 8, 2014 20:43
WP: Custom length for content, excerpt, title, etc. using WP's wp_trim_words function
<?php
/* Trim content, excerpt, or any other string of text to a specified number of words */
wp_trim_words( $text, $num_words = 55, $more = '...' );
/* Custom function to trim the title. Use in place of get_the_title()
Example usage showing max 10 words of the title: <?php echo intw_trim_title(10); ?> */
function intw_trim_title($n) {
return wp_trim_words( get_the_title(), $n );
}
@intelliweb
intelliweb / hide_admin_bar.php
Created June 11, 2014 19:25
WP: remove/hide the WP admin bar for all users who cannot edit posts
<?php
// Remove WP admin bar for all users who can’t edit posts
add_action('set_current_user', 'intw_hide_admin_bar');
function intw_hide_admin_bar() {
if (!current_user_can('edit_posts')) {
show_admin_bar(false);
}
}
@intelliweb
intelliweb / remove_wp_ver_param.php
Created April 2, 2014 19:28
WP: Remove URL version parameter from enqueued styles and scripts
<?php
// Remove WP version parameter from ALL enqueued styles and scripts
add_filter( 'style_loader_src', 'intw_remove_wp_ver_param', 9999 );
add_filter( 'script_loader_src', 'intw_remove_wp_ver_param', 9999 );
function intw_remove_wp_ver_param( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
@intelliweb
intelliweb / gf_remove_entry.php
Last active November 28, 2017 19:00
Gravity Forms: automatically delete form entries from a specific form immediately after entry is submitted. Originally: http://www.gravityhelp.com/forums/topic/purposefully-not-save-form-in-entries-database#post-15601
<?php
// Delete form entry immediately after it is processed and saved
// change '_1' to the form ID
add_action('gform_post_submission_1', 'remove_form_entry', 10, 2);
function remove_form_entry($entry, $form){
global $wpdb;
$lead_id = $entry['id'];
$lead_table = RGFormsModel::get_lead_table_name();
@intelliweb
intelliweb / add_custom_stylesheet.php
Created November 5, 2013 20:39
WP: Enqueue custom stylesheet (custom.css)
<?php
// Enqueue custom stylesheet
add_action('wp_enqueue_scripts', 'intw_custom_styles');
function intw_custom_styles() {
wp_enqueue_style( 'custom-styles', get_stylesheet_directory_uri() . '/custom.css', '1.0.0', 'all' );
}