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 | |
//Customise the dropdown 'choose an option' | |
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'wcvdc_dropdown_choice', 10); | |
// Displays the custom "Choose an option" on the front end | |
function custom_dropdown_choice( $args ){ | |
$args['show_option_none'] = "Select an option:"; |
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 | |
//Customise the dropdown 'choose an option' | |
add_filter('woocommerce_dropdown_variation_attribute_options_args', 'wcvdc_dropdown_choice', 10); | |
// Displays the custom "Choose an option" on the front end | |
function custom_dropdown_choice( $args ){ | |
global $product; |
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 | |
function add_pages_to_dropdown( $pages, $r ){ | |
if ( ! isset( $r[ 'name' ] ) ) | |
return $pages; | |
if ( 'page_on_front' == $r[ 'name' ] ) { | |
$args = array( | |
'post_type' => 'post' |
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 | |
add_action('pre_get_posts', function($q){ | |
// Check to see if static page is set for the homepage. | |
if (!is_admin() && $q->is_main_query() && 'page' === get_option('show_on_front')) { | |
//Determine if current post is homepage | |
if ($q->get("page_id") == get_option("page_on_front")) { | |
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 | |
function get_primary_cat_id($id=Null){ | |
if(!$id){ | |
$id = get_the_ID(); | |
} | |
if(get_post_type($id)!="post"){ | |
$meta_value = "_yoast_wpseo_primary_" . get_post_type($id). "_cat"; |