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 // 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 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
/** | |
* Disable out of stock variations | |
* https://github.com/woocommerce/woocommerce/blob/826af31e1e3b6e8e5fc3c1004cc517c5c5ec25b1/includes/class-wc-product-variation.php | |
* @return Boolean | |
*/ | |
function wcbv_variation_is_active( $active, $variation ) { | |
if( ! $variation->is_in_stock() ) { | |
return false; | |
} | |
return $active; |
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 // Do not copy this line | |
/** | |
* Register a "Wide" image size and add it to the Image Size options | |
* after "Large" i.e. Thumnail, Medium, Large, Wide, Full Size | |
* to correspond with Align Wide and Align Full alignments | |
*/ | |
// Add a new "Wide" image size | |
add_image_size( 'wide', 1200, 0 ); |
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 // 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 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 // don't include this tag | |
add_filter( 'astra_block_editor_dynamic_css', 'child_block_editor_inline_styles' ); | |
function child_block_editor_inline_styles( $styles ) { | |
$styles .= ' | |
.editor-styles-wrapper .wp-block{ | |
max-width: ' . astra_get_option('blog-single-max-width') . 'px; |
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 // Don't include this opening tag | |
/** | |
* Add inline styles to admin head | |
*/ | |
add_action( 'admin_head', 'child_block_editor_styles' ); | |
function child_block_editor_styles() { | |
if ( 'post' == get_post_type() ) : | |
?> |
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_filter( 'wp_calculate_image_srcset', 'child_hero_image_srcset', 10, 5 ); | |
/** | |
* Remove sources from the srcset array | |
* Only use large and above | |
* | |
* @link https://www.smashingmagazine.com/2016/09/responsive-images-in-wordpress-with-art-direction/ | |
*/ | |
function child_hero_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ) { |
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 | |
/** | |
* Disable page caching in WP Rocket. | |
* | |
* @link http://docs.wp-rocket.me/article/61-disable-page-caching | |
*/ | |
add_filter( 'do_rocket_generate_caching_files', '__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 // Do not copy this line | |
add_filter( 'pre_get_posts', 'dw_exclude_noindex_content_from_search' ); | |
function dw_exclude_noindex_content_from_search($query) { | |
// Only run this query for searches when not inside the admin | |
if ( $query->is_search && !is_admin() ) { | |
// Find all posts with `_yoast_wpseo_meta-robots-noindex` postmeta that equal to `1` |
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( 'woocommerce_before_shop_loop', 'onn_modify_affiliates_category_buttons' ); | |
function onn_modify_affiliates_category_buttons() { | |
if ( is_product_category() ){ | |
global $wp_query; | |
// Get current product category |