Hide Certain Posts from Homepage

  • Author
    Posts
  • #151059

    Hello!

    I am looking for a way to hide certain posts from the main homepage feed. Similar to the question asked here.

    It doesn’t necessarily have to be a specific category (although that would work). But some way to pick and choose certain posts to not appear except by a direct link and/or a menu heading.

    The blog I need help with is arsenalweekly.com.

    #151084

    themezee
    Theme Author

    Hi there,

    The best way to exclude posts from your main blog page is by using extra plugins. For example: https://wordpress.org/plugins/ultimate-category-excluder/

    Other than that, you can hide posts with CSS snippet if you’re not able to install plugins:

    .home .type-post.category-objective-player-ratings {
        display: none;
    }

    That will hide all posts from the category with the slug objective-player-ratings. Of course you can adjust the slug to a different category.

    You can copy the CSS code and insert it on Customize > CSS.

    Best,
    Thomas

    #151089

    The CSS code worked like a charm. Thanks :)

    #151739

    Hi Thomas,

    Following on from the question you answered above, I have a few follow-up questions.

    1) I have successfully hidden a category from the homepage using the snippet you provided above, but when I do that the hidden posts are not replaced with other posts, so the number of posts showing on the homepage becomes much less, leading to a lot of unwanted white space. Is there a way to replace the hidden posts with other posts so the homepage remains fully populated?

    2) Is it possible to hide specific individual posts from the homepage, but so they do still appear in Categories?

    3) Is there a limit to the number of posts that you can stick (pin) to the homepage?

    Many thanks,

    Steven

    #151740

    Would also be curious to hear the answer to question 1 :)

    #151852

    themezee
    Theme Author

    Hi there,

    1) Yes, that is possible by really removing the posts from the page by using the plugin: https://wordpress.org/plugins/ultimate-category-excluder/

    With CSS, the post is just hidden afterwards, but actually exists in the HTML markup.

    2) The plugin allows to exclude posts from a specific category just on the front page, but not in categories.

    3) There is no limit, but sticky posts work outside of the normal post query, so if you stick 50 posts then your home page will show 50 posts and then the default 10 posts on top of that. In general, I recommend not to make more than 1-2 posts sticky.

    Cheers,
    Thomas

The topic ‘Hide Certain Posts from Homepage’ is closed to new replies.