- This topic has 9 replies, 3 voices, and was last updated 2 years ago by David.
-
AuthorPosts
-
April 24, 2022 at 8:10 pm #2198950Paul
so i have a page ‘insights’ for a blog, and set it to masonry layout in customization and set the ‘reading’ option to the insights page, and that works.
however, on the insights page editing, i set all but one category on the categories option on the latest posts widget, and the masonry layout seems to ignore that setting and display all posts regardless of category. so that’s one issue.plus, i’d like to display the other category on a separate page with the masonry layout. is that possible? looks like maybe the blog generatepress layout items are only for a default blog of everything? i did notice though that if i go to the standard wordpress ../category/<special-category> it displays a header of <special-category> (which i don’t want) and the masonry of the category posts below.
April 24, 2022 at 8:42 pm #2198958Fernando Customer SupportHi Paul,
To have a better understanding of the issue, may you kindly provide the link to the site in question?
You may use the private information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Hope to hear from you soon. 🙂
April 25, 2022 at 7:18 am #2199427Paulhere you go (in private).
April 25, 2022 at 7:42 am #2199454DavidStaffCustomer SupportHi there,
the Insights page is the the page you have set to Display your Latest Posts in Settings > Reading.
When you apply that setting WordPress completely ignores anything you do in the page editor and instead displays the Blog Template of the Theme.OK so if i understand correctly you want to exclude a category from the Blog ( insights ) page? If so add this PHP Snippet your site:
function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '-66' ); } } add_action( 'pre_get_posts', 'exclude_category' );
In that code you will see
-66
which refers to the Category ID you want to exclude. To get that ID, go to Dashboard > Posts > Category and edit the Post Category you want to exclude, and check the URL in the Browser search field it will say the ID=XX something.April 25, 2022 at 7:47 am #2199461Paulthat’s great David, and worked. thank you.
next challenge… so for the other page i want with the excluded category of posts shown, how do i get the nice generatepress masonry layout on that page?
April 25, 2022 at 7:52 am #2199663DavidStaffCustomer SupportAs you mentioned above, you simply follow the
https://yourdomain.com/category/cat-term
URL and that will display the choosen cat-term eg.corporate
with masonry.April 25, 2022 at 7:54 am #2199671Paul2 issues:
1) client wants a custom page url for that category (not /category/corporate)
2) the category page shows a title which i don’t want.April 25, 2022 at 8:09 am #2199693DavidStaffCustomer Support1. Removing the Category base from the URL.
Give this plugin a shot:https://wordpress.org/plugins/remove-category-url/
2. Add this PHP Snippet to remove archive titles:
add_action( 'after_setup_theme', function() { remove_action( 'generate_archive_title', 'generate_archive_title' ); } );
April 25, 2022 at 8:20 am #2199710Paulyou. are. awesome.
thanks so much!
April 25, 2022 at 9:16 am #2199752DavidStaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.