• wilson1983

    (@wilson1983)


    I want to add subheading to my product category pages.

    I tried this code, which I put together from two other snippets. One to remove the sidebar from the product category page and one to remove subheading under products page title.

    function add_subheading_to_category( $subheading ) {
     
        // Set subheading to Yoast Breadcrumb
        if (  is_shop() || is_product() || is_product_category() ) {
            $subheading = '[wpseo_breadcrumb]';
        }
     
        // Return the subheading
        return $subheading;
        
    }
    add_filter( 'ocean_post_subheading', 'add_subheading_to_category' );

    Unfortunately it does not work and I do not get the reason for this.

    • This topic was modified 3 years ago by wilson1983.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter wilson1983

    (@wilson1983)

    My snippet is working for the shop page and for the products. It just doesn’t work for the product categories. Very strange since the “remove sidebar snippet” I used as a template works on all three types of pages.

    Thread Starter wilson1983

    (@wilson1983)

    In the meantime I added pages and (“normal”) categories as well.

    …is_page() || is_category() || is_shop() || is_product() || is_product_category()…

    Works fine everywhere, on pages, category pages, the shop page, product pages.
    Just not for product category pages. I don’t get it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add subheading to category page’ is closed to new replies.