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 // Do not copy this line | |
/** | |
* Place this shortcode in the form confirmation message. Usage: | |
* | |
* [ga4_event] will send 'form_submit' event by default | |
* [ga4_event name="submit_enquiry"] to send 'submit_enquiry' event | |
* [ga4_event name="subscribed_to_newsletter"] to send 'subscribed_to_newsletter' event | |
*/ |
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 // Do not copy this line | |
function child_exclude_noindex_from_search( $query ) { | |
if( $query->is_main_query() && $query->is_search() ) { | |
$meta_query = isset( $query->meta_query ) ? $query->meta_query : array(); | |
$meta_query['noindex'] = array( | |
'key' => 'rank_math_robots', | |
'value' => "noindex", |
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 // Don't copy this line | |
function ele_disable_page_title( $return ) { | |
$post_id = get_the_ID(); | |
$elementor = Elementor\Plugin::$instance->documents->get( $post_id )->is_built_with_elementor(); | |
if ( $elementor == 1 ) { | |
return false; | |
} | |
else { | |
return $return; |
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 // Don't copy this line | |
function example_theme_support() { | |
remove_theme_support( 'widgets-block-editor' ); | |
} | |
add_action( 'after_setup_theme', 'example_theme_support' ); |
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 | |
/** | |
* Let's say we have an ACF repeater field with 2 sub-fields: | |
* | |
* Section | |
* - Title | |
* - Description | |
* | |
* This code snippet will automatically load 3 instances of the Section, and pre-fill the titles. |
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 // don't copy this line | |
add_filter( 'pp_post_image_settings_data', function( $data, $settings ) { | |
if ( isset( $data['attributes'] ) && isset( $data['attributes']['data-no-lazy'] ) ) { | |
unset( $data['attributes']['data-no-lazy'] ); | |
} | |
return $data; | |
}, 10, 3 ); |
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 // don't copy this line | |
/** | |
* Modify the $image_id variable and replace 'medium_large' with desired image size | |
* See: https://web.dev/optimize-lcp/?utm_source=lighthouse&utm_medium=unknown#preload-important-resources | |
* Note: don't go overboard and preload too many assets, just ones that appear above the fold | |
*/ | |
add_action( 'wp_head', 'child_preload_assets', 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
// Move `.element` into `#inner-wrap` | |
// The code has to appear after the elements, otherwise it will throw an error | |
const moveMe = document.querySelector('#main .element'); | |
const target = document.querySelector('#inner-wrap'); | |
target.appendChild(relatedPosts); |
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
<script> | |
// Load only after DOMContentLoaded event | |
window.addEventListener('DOMContentLoaded', function() { | |
(function($) { | |
// do something | |
})(jQuery); | |
}); | |
</script> |
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 // don't copy this line | |
/** | |
* Add a note to WooCommerce checkout | |
* | |
* This snippet adds a message to the checkout screen. You can have the message appear at different location | |
* by changing the `woocommerce_review_order_before_payment` hook to any other hook. Refer to: | |
* https://www.businessbloomer.com/woocommerce-visual-hook-guide-checkout-page/ | |
*/ |
NewerOlder