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 include this line | |
/** | |
* Add new font group (Custom) to the top of the list | |
*/ | |
add_filter( 'elementor/fonts/groups', function( $font_groups ) { | |
$new_font_group = array( 'custom' => __( 'Custom' ) ); | |
return array_merge( $new_font_group, $font_groups ); | |
} ); |
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 'Awaiting pre-order' custom status | |
* | |
* 1. Register new order status | |
* 2. Add to list of WC order statuses | |
* 3. Add your custom bulk action in dropdown | |
* 4. Bulk action handler | |
* 5. Admin notices for bulk action |
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); |
NewerOlder