- This topic has 7 replies, 3 voices, and was last updated 1 year, 7 months ago by Fernando.
-
AuthorPosts
-
September 4, 2022 at 12:32 pm #2333285Fergal
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?
Thanks,
FergalSeptember 4, 2022 at 1:23 pm #2333306DavidStaffCustomer SupportHi there,
yes, that is one method, and would work well.
Will the Latest Posts lists have pagination ?September 4, 2022 at 1:26 pm #2333311FergalHey David,
Thanks for your reply. Yes will want pagination for the posts (latest posts) on the homepage.
Regards,
FergalSeptember 4, 2022 at 1:29 pm #2333313DavidStaffCustomer SupportOK, 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
September 4, 2022 at 1:47 pm #2333321FergalSounds 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?
Thanks,
FergalSeptember 4, 2022 at 6:12 pm #2333391Fernando Customer SupportHi 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.
September 5, 2022 at 11:00 am #2334141FergalAwesome, thanks Fernando.
September 5, 2022 at 6:13 pm #2334305Fernando Customer SupportYou’re welcome Fergal!
-
AuthorPosts
- You must be logged in to reply to this topic.