[Resolved] Removing Default Column Posts from Category

Home Forums Support [Resolved] Removing Default Column Posts from Category

Home Forums Support Removing Default Column Posts from Category

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2379960
    Mihail

    Hello,

    I am struggling to remove the 3 columns and the default category posts from a specific category page.

    I just want the Block – Page Hero element I created to appear on the specific category page. I posted the URL of the category below. How do I do this?

    Any help will be appreciated,
    Mihail.

    #2379984
    David
    Staff
    Customer Support

    Hi there,

    try adding this PHP Snippet to your site:

    
    add_filter( 'generate_has_default_loop', function($loop){
        if ( is_category( 'no-surgery' ) ) {
            $loop = false;
        }
        return $loop;
    } );

    Make sure the the no-surgery is the correct category slug.

    #2380177
    Mihail

    Hello David, thank you for the reply.

    I added the PHP Snippet to my site, and it successfully removed the columns. However, it removed the 3 columns and the default category posts from all of my category pages, not just the category with no-surgery slug.

    What should I do next to correct this?

    Thank you,
    Mihail.

    #2380184
    David
    Staff
    Customer Support

    Doh! – i updated the code above to fix a stupid error…

    #2380195
    Mihail

    Thank you David for the fast reply.

    This corrected the issue. Thanks a lot.

    #2380199
    David
    Staff
    Customer Support

    Awesome – glad to be of help!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.