- This topic has 8 replies, 3 voices, and was last updated 5 years, 6 months ago by
David.
-
AuthorPosts
-
October 22, 2020 at 5:37 am #1499688
Anders Nielsen
Hi
How can I make posts from a certain categori look like the pages (with no comments, no links to other post etc. ) So a post will have the same look and feel like a page, when the post is in a specific categori?
October 22, 2020 at 7:16 am #1499820David
StaffCustomer SupportHi there,
would take a few steps.
1. The Header Element for your posts – edit the elements Display Rules to Exclude the Post Category
2. Create a new Layout Element and set the Content to Full Width and to disable any elements you don’t require. And set Display Rule Location to the Post Category.
3. Removing the comments – simple way would be some CSS:article.category-byer + .comments-area { display: none; }I used the
category-byerslug found on that posts.4. To remove the Blog footer meta – try adding this PHP Snippet:
add_action( 'wp', function() { if ( in_category('byer') ) { remove_action( 'generate_after_entry_content', 'generate_footer_meta' ); remove_action( 'generate_after_entry_title', 'generate_post_meta' ); } } );https://docs.generatepress.com/article/adding-php/
Then its just a case of editing those posts like you would a full width page.
October 22, 2020 at 7:40 am #1499852Anders Nielsen
Done all the above..
And we are almost there… missing two blog elements… the “next” blog link and the “name and date”
Both at the left of the page
October 22, 2020 at 8:45 am #1500147Anders Nielsen
So I guess, that this snippet is not working:
add_action( 'wp', function() { if ( is_single() && has_term('', 'byer') ) { remove_action( 'generate_after_entry_content', 'generate_footer_meta' ); } } );(inserted in functions.php)
I use generatepress 3.0.2
GP Premium 1.12.2October 22, 2020 at 1:01 pm #1500454Tom
Lead DeveloperLead DeveloperHi there,
Are you trying to target a specific term, or all posts that have a specific taxonomy?
October 22, 2020 at 1:05 pm #1500458Anders Nielsen
Hi
I try to target all posts with the category “byer”.
Or is it called taxonomy (categorys)
then I’m trying to catch all posts that have a specific taxonomy
October 23, 2020 at 1:00 am #1500832David
StaffCustomer SupportI have updated the PHP snippet here:
https://generatepress.com/forums/topic/template-for-posts-to-look-like-a-page/#post-1499820
Can you try that
October 23, 2020 at 1:10 am #1500838Anders Nielsen
Works 🙂
Thx
October 23, 2020 at 1:44 am #1500874David
StaffCustomer SupportGlad to hear that
-
AuthorPosts
- You must be logged in to reply to this topic.