[Resolved] Template for POSTS to look like a page

Home Forums Support [Resolved] Template for POSTS to look like a page

Home Forums Support Template for POSTS to look like a page

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #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?

    #1499820
    David
    Staff
    Customer Support

    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.

    #1499852
    Anders 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

    #1500147
    Anders 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.2

    #1500454
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Are you trying to target a specific term, or all posts that have a specific taxonomy?

    #1500458
    Anders 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

    #1500832
    David
    Staff
    Customer Support
    #1500838
    Anders Nielsen

    Works 🙂

    Thx

    #1500874
    David
    Staff
    Customer Support

    Glad to hear that

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.