This file contains hidden or 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
| const browserWidth = (window.innerWidth > 0) ? window.innerWidth : screen.width; | |
| console.log(browserWidth); |
This file contains hidden or 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
| /** | |
| * Hide email from Spam Bots using a shortcode. | |
| * | |
| * @param array $atts Shortcode attributes. Not used. | |
| * @param string $content The shortcode content. Should be an email address. | |
| * | |
| * @return string The obfuscated email address. | |
| */ | |
| function wpcodex_hide_email_shortcode( $atts, $content = null ) { | |
| if ( ! is_email( $content ) ) { |
This file contains hidden or 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
| (function () { | |
| /** | |
| * Elements | |
| */ | |
| const arrows = document.querySelectorAll(".mfp-arrow"); | |
| /** | |
| * Events |
This file contains hidden or 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 remove-lazy-loading class to featured images | |
| function add_class_to_featured_image($attr) | |
| { | |
| $attr['class'] .= ' remove-lazy-loading'; | |
| return $attr; | |
| } | |
| add_filter('wp_get_attachment_image_attributes', 'add_class_to_featured_image', 10, 1); | |
| // Remove lazy loading from featured post images |
This file contains hidden or 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
| function site_url_check() | |
| { | |
| $url = $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; | |
| if (strpos($url, 'site.com') >= 0 || strpos($url, 'site.dev') >= 0) { | |
| return true; | |
| } else { | |
| return false; | |
| } | |
| } |
This file contains hidden or 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 a 'Add rel="nofollow" to link' checkbox to the WordPress link editor | |
| * | |
| * @see https://danielbachhuber.com/tip/rel-nofollow-link-modal/ | |
| */ | |
| add_action( 'after_wp_tiny_mce', function(){ | |
| ?> | |
| <script> |
This file contains hidden or 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
| --- | |
| exclude_paths: | |
| - ".*[\.-]min\.css" | |
| - ".*[\.-]min\.js" | |
| - ".*node_modules/.*" | |
| - "*vendor/.*" | |
| - ".bundle/**" | |
| - "spec/**/*" | |
| - "benchmarks/**/*" | |
| - "**.min.js" |
This file contains hidden or 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
| /** | |
| * Function to log PHP vars to the console | |
| */ | |
| function console_log($output, $with_script_tags = true) { | |
| $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) . ');'; | |
| if ($with_script_tags) { | |
| $js_code = '<script>' . $js_code . '</script>'; | |
| } |
This file contains hidden or 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 | |
| // Selectively add async and defer attributes to scripts loaded from wp_enqueue_scripts | |
| function defer_enqueue_scripts( $tag, $handle, $src ) { | |
| $defer = array( | |
| 'script-one', | |
| 'script-two' | |
| ); | |
| $async = array( |
NewerOlder