[Support request] Different blog views

Home Forums Support [Support request] Different blog views

Home Forums Support Different blog views

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2170013
    WebbPlatsen

    I want to use two different blog views. Which blog view to use depends on a Custom Post Type value each post have.

    If I simplify this a lot it could be like following.

    Blog view A:
    Display 3 posts
    Featured image
    Title
    Excerpt

    Blog view B:
    Display 1 post
    Title
    Featured image
    Full page (All content)

    Should I modify content.php in my child theme?

    #2170030
    David
    Staff
    Customer Support

    Hi there,

    how are the two ‘blog views’ displayed ?
    Can you share a URL to both of them ?

    #2170721
    WebbPlatsen

    There is no website available right now.
    This is how it could look like.
    Main thing is to have different blog views.

    —————-

    Blog View A:

    Post #1
    Featured Image
    Title
    Excerpt
    – – –
    Post #2
    Featured Image
    Title
    Excerpt
    – – –
    Post #3
    Featured Image
    Title
    Excerpt

    ————————

    Blog View B:

    Post #1
    Title
    Featured Image
    Content

    #2170725
    Fernando
    Customer Support

    Hi there,

    Is Blog View A an archive? If so, you can use a Content Template – Block Element to achieve this: https://docs.generatepress.com/article/block-element-content-template/

    For Blog View B, you can you a Page Hero – Block Element.

    Both should work for Custom Post types.

    Or, perhaps you’re referring to something else? Kindly let us know.

    Hope this clarifies. 🙂

    #2170752
    WebbPlatsen

    It’s not an archive.
    Right now Blog View B only display one post, but tomorrow it could be 5 posts.
    I have just simplified these two views to show my basic needs looks like.

    In each post, it will be some integration with other services. I will use custom code (PHP etc) to solve this.

    I understand you want to solve this with Block Elements etc but there will a lot of custom behaviors.

    #2170760
    Fernando
    Customer Support

    I see. Thank you for clarifying.

    If that’s the case, following the template hierarchy, you can create a archive-{post_type}.php based on archive.php for the archive pages of the Custom Post Type.

    Reference: https://developer.wordpress.org/themes/template-files-section/custom-post-type-template-files/

    Archive.php: https://github.com/tomusborne/generatepress/blob/master/archive.php

    Hope this helps! 🙂

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