Site logo

Archived topic

Multiple Static Frontpage / Selected Posts on Frontpage

12 replies · Started by hari on December 2, 2015

Viewing posts 1–13 of 13

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

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 :)

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!

That's a great plugin to use :)

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

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

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' );

That works, thank you Leo!

No problem :)

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

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

Thanks :)

will do.:)

Thanks

Thanks :)

This archived topic is closed to new replies.