Archived topic
Template for POSTS to look like a page
8 replies · Started by Anders Nielsen on October 22, 2020
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?
Hi 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-byer slug 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.
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
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.2
Hi there,
Are you trying to target a specific term, or all posts that have a specific taxonomy?
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
I 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
Works :)
Thx
Glad to hear that