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 | |
| /** | |
| * FYKI: ONLY USE THIS IF THERE ARE MAX 4-5 SVGs ON THE PAGE - even if caching is handled with | |
| * transients, THERE'S ALWAYS A FIRST LOAD, and with 10-20-30-more SVGs on the same page | |
| * file_get_contents kills your site's performance upon the first load, AND I MEAN IT!!! | |
| * WE'RE TALKING ABOUT LOSING 4-5-10 SECONDS BECAUSE OF THIS SHIT!!! | |
| * | |
| * WHAT'S THE FIX THEN? | |
| * | |
| * NO FIX: if there are tons of svgs on one page, you MUST NOT USE SVGs AS IMAGES UPLOADED |
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_action('the_content', function() { | |
| $noindex_pages = new WP_Query( [ | |
| 'post_type' => 'page', | |
| 'post_status'=> array('publish', 'private'), | |
| 'meta_query' => [ | |
| [ | |
| 'key' => 'rank_math_robots', | |
| 'value' => '"noindex"', // key part: search for serialized string match |
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
| <!-- wp:paragraph {"align":"center","customTextColor":"#000000","backgroundColor":"very-light-gray","fontSize":"small"} --> | |
| <p style="color:#000000;text-align:center" class="has-background has-small-font-size has-very-light-gray-background-color">Gutenberg Sample Content.<br/>Put together with ❤️ by <a href="https://artisanthemes.io/">Artisan Themes</a>.</p> | |
| <!-- /wp:paragraph --> | |
| <!-- wp:heading {"level":1} --> | |
| <h1>This is a heading (H1)</h1> | |
| <!-- /wp:heading --> | |
| <!-- wp:heading --> | |
| <h2>This is a heading (H2)</h2> |
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 | |
| /** | |
| * Remove "Patterns" menu item from the "Appearance" submenu | |
| */ | |
| add_action('admin_menu', function() { | |
| remove_submenu_page('themes.php', 'site-editor.php?path=/patterns'); | |
| }); |
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
| jQuery(document).ready(function($){ | |
| if ( $('.map-slider-component').length ) { | |
| $('.map-slider-component .select-city').select2({ | |
| width: '100%', | |
| minimumResultsForSearch: Infinity // hide the search box | |
| }); | |
| // Custom class provision upon select2 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
| /** | |
| * Attaches the specified template to the posts of the identified post type. | |
| * | |
| * @params $post_type The name of the post type to attach the template to. | |
| * @params $template_path The template's filename (assumes .php' is specified) | |
| * | |
| * @returns empty array if the post type does not have posts; otherwise, | |
| * the post id array of the updated posts. | |
| */ | |
| function attach_template_to_post_type( $post_type, $template_file_name ) { |
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 | |
| // Option 1: Use `WP_Query` | |
| $query = new WP_Query( | |
| array( | |
| 'post_type' => 'page', | |
| 'title' => 'Sample Page', | |
| 'post_status' => 'all', | |
| 'posts_per_page' => 1, | |
| 'no_found_rows' => true, | |
| 'ignore_sticky_posts' => true, |
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 | |
| if (!function_exists('write_log')) { | |
| function write_log($log) { | |
| if (true === WP_DEBUG) { | |
| if (is_array($log) || is_object($log)) { | |
| error_log(print_r($log, true)); | |
| } else { | |
| error_log($log); | |
| } |
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 | |
| global $post; | |
| if ( is_a($post, 'WP_Post') ) : | |
| $post_id = $post->ID; | |
| $elementor_data = get_post_meta($post_id, '_elementor_controls_usage', true); | |
| $has_fl_map = array_key_exists('fl-map', $elementor_data); |
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
| /** | |
| * VERSION 1 - DEVICE-SPECIFIC + GLOBAL | |
| * ----------------------------------------------------------------------------------------------------- | |
| */ | |
| const checkIphone = () => { | |
| const u = navigator.userAgent | |
| return !!u.match(/iPhone/i) | |
| }, | |
| checkAndroid = () => { |
NewerOlder