Skip to content

Instantly share code, notes, and snippets.

@intelliweb
intelliweb / mjml-api-invalid-json-request
Created Oct 22, 2019
MJML issue #1736: API sometimes returns invalid JSON
View mjml-api-invalid-json-request
{"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 Oct 22, 2019
MJML issue #1736: API sometimes returns invalid JSON
View mjml-api-invalid-json-request
{"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-
View CSS_filter_effects.md

##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 Dec 12, 2014
GF: Remove admin menu item by user capability. Be sure to add custom capability first!
View remove_gf_admin_menu.php
<?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 Oct 2, 2014
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.
View disable_admin_bar_search.php
<?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 Aug 8, 2014
WP: Custom length for content, excerpt, title, etc. using WP's wp_trim_words function
View custom_string_length.php
<?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 Jun 11, 2014
WP: remove/hide the WP admin bar for all users who cannot edit posts
View hide_admin_bar.php
<?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 Apr 2, 2014
WP: Remove URL version parameter from enqueued styles and scripts
View remove_wp_ver_param.php
<?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 Nov 28, 2017
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
View gf_remove_entry.php
<?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 Nov 5, 2013
WP: Enqueue custom stylesheet (custom.css)
View add_custom_stylesheet.php
<?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' );
}