- This topic has 12 replies, 5 voices, and was last updated 5 years, 1 month ago by
Leo.
-
AuthorPosts
-
December 2, 2015 at 3:54 pm #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
December 3, 2015 at 12:15 am #157558Tom
Lead DeveloperLead DeveloperHi 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 🙂
December 3, 2015 at 12:24 am #157562hari
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-SnippetThanks!
December 3, 2015 at 12:24 am #157564Tom
Lead DeveloperLead DeveloperThat’s a great plugin to use 🙂
December 3, 2015 at 12:27 am #157566hari
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!
HariAugust 27, 2019 at 10:41 am #994827Sami
Hi Tom, how should I customize the code to make it work with a tag instead of a category?
August 27, 2019 at 10:50 am #994835Leo
StaffCustomer SupportTry 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' );
August 28, 2019 at 1:20 am #995178Sami
That works, thank you Leo!
August 28, 2019 at 8:40 am #995596Leo
StaffCustomer SupportNo problem 🙂
February 15, 2020 at 4:28 pm #1166575Manoj
Tom,
I need to show multiple categories and exclude a few.
How do I do that?February 15, 2020 at 4:32 pm #1166578Leo
StaffCustomer SupportAny chance you can open a new topic for your question as this one has multiple authors already?
Thanks 🙂
February 15, 2020 at 7:48 pm #1166636Manoj
will do.:)
Thanks
February 16, 2020 at 8:05 am #1167230Leo
StaffCustomer SupportThanks 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.