This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This was specifically for Gravity Form i wanted to disable options based on a null value. | |
// In the dropdown I had, some values were used as headers so people would know the type of | |
// item they were selecting -- in this case the dropdown was for liquor/wine selection | |
// Before to put the "true" part after disabled rather than leaving it blank | |
// or it won't work in any browser but Chrome (Mac). | |
// gForm disable select options with null or '|0' value | |
$('.gform_body select option[value="null|0"]').attr("disabled","true"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a surrounding <div> for all the ish don't want to keep once submission is successful | |
<script type='text/javascript' src='//s3.amazonaws.com/downloads.mailchimp.com/js/mc-validate.js'></script> | |
<script type='text/javascript'>(function($) {window.fnames = new Array(); window.ftypes = new Array();fnames[1]='FNAME';ftypes[1]='text';fnames[0]='EMAIL';ftypes[0]='email';}(jQuery)); | |
//var $mcj = jQuery.noConflict(true); | |
</script> | |
<script> | |
$(function(){ | |
//$("#mcm_hide_on_submit").hide(); | |
$(".button").on("click", function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Put this in your functions.php file | |
// Changes wp-login.php page title | |
// Here I'm removing the default "WordPress" at the end of it ~mj | |
function custom_login_title( $login_title ) { | |
return str_replace(array( ' ‹', ' — WordPress'), array( ' ‹', ''),$login_title ); | |
} | |
add_filter( 'login_title', 'custom_login_title' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Put this in your functions.php or custom functionality plugin | |
// remove all classes from anchors in menus ~mj | |
function mj_remove_classes_from_all_menu_anchors( $atts ) { | |
$atts['class'] = ''; // not it's blank; if you add classes like 'example1 class2', it'll add classes ~mj | |
return $atts; | |
} | |
add_filter( 'nav_menu_link_attributes', 'mj_remove_classes_from_all_menu_anchors', 10 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Add 'text-external' class and rel="external noopener noreferrer" to anchors that are external links | |
* (this.hostname !== location.hostname) but NOT to anchors containing images or subsequent parameters. | |
* Adds a target="_blank" to all external links, so no need to manually write it in | |
* Notice multiple parameters for .not() ~mj */ | |
function addImageToExternalLinks() { | |
$("a").filter(function() { | |
//console.log('Inside addImagetoExternalLinks()') | |
//console.log('this.hostname: ' + this.hostname) | |
//console.log('location.hostname: ' + location.hostname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Put in functions.php or custom functionality plugin. | |
// Remove article:tag meta that Yoast's WordPress SEO outputs ~mj | |
function remove_wpseo_fb_tags_categories() { | |
global $wpseo_og; | |
remove_action('wpseo_opengraph', array($wpseo_og, 'tags'), 16); | |
remove_action('wpseo_opengraph', array($wpseo_og, 'category'), 17); | |
} | |
add_action('wpseo_opengraph', 'remove_wpseo_fb_tags_categories'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @desc Add .img-responsive to all post images ~mj | |
*/ | |
function add_post_img_responsive_class($attr) { | |
$attr['class'] .= ' img-responsive'; // note the leading space | |
return $attr; | |
} | |
add_filter('wp_get_attachment_image_attributes', 'add_post_img_responsive_class'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add this to `core-emails.php` file in the ACF Advanced Forms plugin ~mj | |
// From header | |
$from = af_resolve_field_includes( $email['from'], $fields ); | |
$replyto = af_get_field( 'email'); | |
$headers[] = 'From:' . $from; | |
// only have reply-to to Customer if it's admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Display ACF field names for development for Administrator only | |
function display_acf_field_names( $field ) { | |
echo $field['_name']; | |
} | |
if(is_admin() && !current_user_can('manage_options')) { | |
add_action( 'acf/render_field', 'display_acf_field_names', 10, 1 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* I use this in a separate config-properties.php or otherwise named file | |
* which is then included by wp-config.php ~mj */ | |
function getRealHost() { | |
list($realHost,) = explode(':',$_SERVER['HTTP_HOST']); | |
return $realHost; | |
} |
NewerOlder