Multiple Static Frontpage / Selected Posts on Frontpage

Home Forums Support Multiple Static Frontpage / Selected Posts on Frontpage

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #157511
    hari

    Hi Tom,

    I realized, I have a requirement/suggestion.

    Please bear with me, that I am unable to scan through all suggestions here, weather mine was already discussed. If this is duplicate, please simply direct me to the answer.

    My requirement is, I need a static frontpage. Thats easy.

    But what I want are multiple! static front pages, that I ideally organize as I wish, with masonry.

    I could explain it the other way around. I need a “normal” view of my articles, but I want to control myself, which ones are presented on the frontpage as masonry.

    Both descriptions point to the same need. I need control over the articles shown on the frontpage. And not just one, but several.

    So I need an explicit article selection of those shown, instead of being forced to accept “the latest” in the timeline on the frontpage.

    I understand, that my wish is more or less, what a full fledged CMS allows and WordPress is simply no full fledged CMS but blogging CMS. And Blogs have timeline in their article flow.

    But I want a showcase of articles on my frontpage, and that conflicts with “the latest”. I hope I was able to explain what I am looking for.

    Maybe you have an idea how to solve it with GP?

    Or maybe you are able to write an Add-On that allows this?

    Thanks for any input.

    Hari

    #157558
    Tom
    Lead Developer
    Lead Developer

    Hi Hari,

    You could add this little snippet and set it so the home page only displays posts from a specific category:

    function generate_home_category( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'category_name', 'home-category-slug' );
        }
    }
    add_action( 'pre_get_posts', 'generate_home_category' );

    The idea comes from here: http://wordpress.stackexchange.com/questions/159689/how-to-remove-certain-category-posts-from-the-blog-page

    Let me know if you need more info 🙂

    #157562
    hari

    Hi Tom, thanks, good idea to solve this via category.

    As I am not a WordPress Expert, a short Question:

    Do you have a recommendation, how to integrate the snippet into the code?

    I guess not by changing GeneratePress functions.php 😉

    Do you have a recommendation, maybe a plugin to use?

    Maybe this plugin?
    Code-Snippet

    Thanks!

    #157564
    Tom
    Lead Developer
    Lead Developer

    That’s a great plugin to use 🙂

    #157566
    hari

    Thanks, will try!

    And if you see the opportunity, to add the functionality to generate press, to have a *list* of pages to be used statically on the frontpage, instead of just one, I would like that too.

    Have a nive day!
    Hari

    #994827
    Sami

    Hi Tom, how should I customize the code to make it work with a tag instead of a category?

    #994835
    Leo
    Staff
    Customer Support

    Try this:

    function generate_home_category( $query ) {
        if ( $query->is_home() && $query->is_main_query() ) {
            $query->set( 'tag', 'TAG-NAME-HERE' );
        }
    }
    add_action( 'pre_get_posts', 'generate_home_category' );
    #995178
    Sami

    That works, thank you Leo!

    #995596
    Leo
    Staff
    Customer Support
    #1166575
    Manoj

    Tom,
    I need to show multiple categories and exclude a few.
    How do I do that?

    #1166578
    Leo
    Staff
    Customer Support

    Any chance you can open a new topic for your question as this one has multiple authors already?

    Thanks 🙂

    #1166636
    Manoj

    will do.:)

    Thanks

    #1167230
    Leo
    Staff
    Customer Support
Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.