Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Might you have set up your homepage as your Shop page, displaying just products?
    WOOCOMMERCE > Settings > Products (tab) > Display (tiny text inline menu) > Shop Page Display (dropdown) > Show Products

    Also, check your Homepage is using the Homepage template (Edit Page > Page Attributes (panel) > Template (dropdown) and you’re looking at the page you think you are (Settings > Reading > “Front Page Displays” Section

    Apologies if my input is a bit “teaching grandma to suck eggs”. I’m often guilty of missing the simple answers myself. For example, re: the funcion I posted earlier, it seems there’s a Homepage Control plugin that may do the same job, by the looks of it.

    Hi thewebplumber,

    I needed to do a similar thing this week. To remove everything from the homepage except Categories, you’d need to add this to your child theme’s functions.php:

    // strip out unnecessary content from homepage
    add_action( 'init', 'custom_remove_homepage_stuff', 10 );
    
    function custom_remove_homepage_stuff() {
       remove_action( 'homepage', 'storefront_homepage_content', 10);
    //   remove_action( 'homepage', 'storefront_product_categories', 20);
       remove_action( 'homepage', 'storefront_recent_products', 30);
       remove_action( 'homepage', 'storefront_featured_products', 40);
       remove_action( 'homepage', 'storefront_popular_products', 50);
       remove_action( 'homepage', 'storefront_on_sale_products', 60);
       remove_action( 'homepage', 'storefront_best_selling_products', 70);
    }

    I’ve left the storefront_product_categories action commented out so you can see everything that would normally be hooked into homepage.

    Then, if you like, you can hook in other functions to build your homepage up. e.g. :

    add_action( 'homepage', 'some_lovely_element', 19 );
    // 19 would put this section before storefront_product_categories
    // 21 would put this section after storefront_product_categories
    
    function some_lovely_element() {
    	?>
    	<div class="something_snazzy">
                <!-- ... code etc. ... -->
    	</div>
    	<?php
    }

    Hope this helps.

    Thread Starter andylamb001

    (@andylamb001)

    Resolved, finally!

    Added the following to my Child theme’s functions.php:

    add_action( 'wp', 'woa_remove_sidebar_shop_page' );
    function woa_remove_sidebar_shop_page() {
    
        if ( is_shop() || is_tax( 'product_cat' ) || get_post_type() == 'product'  ) {
    
            remove_action( 'storefront_sidebar', 'storefront_get_sidebar', 10 );
            add_filter( 'body_class', 'woa_remove_sidebar_class_body', 10 );
        }
    }
    
    function woa_remove_sidebar_class_body( $wp_classes ) {
    
        $wp_classes[] = 'page-template-template-fullwidth-php';
        return $wp_classes;
    }

    Thanks to wooassist’s answer to this post

    Thread Starter andylamb001

    (@andylamb001)

    Resolved!

    Thread Starter andylamb001

    (@andylamb001)

    Cheers Mikey! I’ll be making plenty of use of the Storefront Forums from now on.

    Yep, that nailed it. Huge thanks!

Viewing 5 replies - 1 through 5 (of 5 total)