- This topic has 3 replies, 2 voices, and was last updated 6 years, 4 months ago by .
- The topic ‘Add to Homepage latest posts? ?’ is closed to new replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
I'd like to customize home page.
I created so far page I'd like to have as my homepage and add some content to it with default WP editor.
I've set page as homepage in WordPress Reading settings.
This is obviously all you need to do to have custom homepage.
But I can't figure out next question.
How to output on homepage below content latest two posts?
The finished homepage should look like:
I'm using default Genesis Framework theme.
There is no default Genesis Framework theme. The Genesis Framework should never be used as a theme. You should use it with a child theme. The Genesis Sample theme is available for free.
Using a static home page, which is what you are doing, won't allow you to add posts to a home page. The static home page is of itself a type of post. Just to display the page, the WordPress loop has already run. This is the way WordPress works.
To display posts and static content you have to create a page template, add your static content to it, then run the genesis() function to initialize the framework and display your posts content. Most Genesis themes come with a front-page template that uses widgets and can display posts.
Just from your question, it sounds like you might need some training in how WordPress and the Genesis Framework work together. I suggest visiting https://knowthecode.io to learn more.
Thanks for the tip.
I'm using Genesis Sample theme. I just thought Genesis Framework is the name for child theme.
I figured out my problem.
I created in my Genesis child theme file named 'front-page.php'.
I add there PHP scripts I wanted to (full-width, custom text...).
Finally this is the script which display only 2 latest posts on homepage:
?><?php query_posts('posts_per_page=2'); ?><?php
Also I set in WP reading settings 'Display latest posts' in homepage.
Little tip: add at the very bottom of the 'front-page.php' script, which actually show posts:
© 2023 WPEngine, Inc.