[Resolved] Custom Post Page

Home Forums Support [Resolved] Custom Post Page

Home Forums Support Custom Post Page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #2333285

    Hey there,

    How do I create a custom blog page?
    I’m looking to accomplish the following on the home page:

    • Page title
    • some descriptive text for the website
    • search bar
    • a section where posts assigned the “featured jobs” category are listed
    • followed by a section of all posts listed (just like a typical blog post page)

    My homepage is set to display latest posts. I’m currently trying a block – page hero element. Is this the right approach?


    Customer Support

    Hi there,

    yes, that is one method, and would work well.
    Will the Latest Posts lists have pagination ?


    Hey David,

    Thanks for your reply. Yes will want pagination for the posts (latest posts) on the homepage.


    Customer Support

    OK, so yes, use the Page Hero Element to add in your Title, descriptive text and post list.

    Now, the thing is that Page Hero will show on the paged instances ( page 2, 3 etc ).
    If you don’t want that, add this PHP Snippet to the site:

    add_filter( 'generate_block_element_display', function( $display, $element_id ) {
        if ( 100 === $element_id && is_paged() ) {
            $display = false;
        return $display;
    }, 10, 2 );

    And change the 100 to the ID of the Block Element.

    We’ll be adding an is_paged location rule to Elements in the next update


    Sounds good thanks David. Continuing off this:

    • How do I add php to the site?
    • Above the list of latest posts, how can I add a section for posts of just a specific (featured jobs) category?
    • I would like the header to be contained and the right sidebar to also display to the right of the header. Currently the header is above the content and right side bar. How can I achieve this?


    Customer Support

    Hi Fergal,https://docs.generateblocks.com/article/query-loop-overview/

    Here’s an article with regards to adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

    You can add a new Block Element hooked to your preferred location(https://docs.generatepress.com/article/hooks-visual-guide/) then add a Query Loop Block: https://docs.generateblocks.com/article/query-loop-overview/

    You can query posts from a specific category through a GenerateBlocks Query Loop Block.

    Lastly, to move the Page Hero to your preferred location, try changing the hook to before_content_container or before_content.


    Awesome, thanks Fernando.

    Customer Support

    You’re welcome Fergal!

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