• Hello, I’m trying to replace the “Products” page title that woocommerce puts as the title on the shop page. I want to put custom text there.

    I’ve disabled the page title because it was also showing up in addition to the header title of “Products” with this code:

    //Remove page title from shopping page
    add_filter( 'woocommerce_show_page_title', 'not_a_shop_page' );
    function not_a_shop_page() {
        return boolval(!is_shop());
    }

    Any idea how to change or get rid of the “Products” text at the top?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Extend Themes

    (@extendthemes)

    Hi @rusticmodern,

    If you do not use the Colibri Page Builder you can add this filter:

    
    add_filter( 'theme_mod_header_post.title.show', function ( $value ) {
        $post_type = get_query_var( 'post_type' );
        if ( $post_type === 'product' ) {
            $value = false;
        }
    
        return $value;
    } );
    
    

    If you use Colibri Page Builder you can override the title shortcode for product pages with a code like this one:

    
    add_action( 'wp', function () {
        $post_type = get_query_var( 'post_type' );
        if ( is_customize_preview() ) {
            return;
        }
    
        if ( $post_type === 'product' ) {
            remove_shortcode( 'colibri_page_title' );
            add_shortcode( 'colibri_page_title', '__return_empty_string' );
        }
    
    } );
    

    Please make sure to create a child theme ( or a plugin ) so your code will not be removed on a future update

    • This reply was modified 5 years, 3 months ago by Extend Themes.
    Thread Starter rusticmodern

    (@rusticmodern)

    Awesome!!! That 2nd one worked!
    I added it to my child theme
    ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Replacing “Products” title on woocommerce shop page’ is closed to new replies.