Home › Forums › Omega Child › Add a few post to home page
- This topic has 6 replies, 2 voices, and was last updated 12 years, 1 month ago by
uNeedShari.
-
AuthorPosts
-
February 7, 2014 at 6:59 pm #1691
uNeedShari
ParticipantI’m wondering if there is any way to add 3 – 5 latest posts to a static home page. I’ve attempted to create a template, but it’s not working with the code I found on wordpress.org
Thanks!
February 20, 2014 at 3:12 am #1792han
KeymasterA static home page will load a page you chose. Go to Administration > Settings > Reading panel, select ‘Your latest posts’ Front page displays and ‘5’ for ‘Blog pages show at most’.
February 20, 2014 at 3:33 am #1793uNeedShari
ParticipantI’m not understanding what you’re saying to do, or it doesn’t work.
I would like a static page AND a few summary’s from the blog. Is this possible?
If I change the setting in wordpress it no longer shows the page, I do not want to use a sticky post either 🙂
Thanks!
February 20, 2014 at 7:35 am #1794han
KeymasterIf you want a static page and blog posts, you need to create a new page called home.php and you can add the code below (Replace the $page_id value with your page ID, you can see page ID on the URL when you edit a page / hover edit link via wp admin)
<?php add_action( 'omega_content', 'show_page_content', 4); function show_page_content() { $page_id = 1632; $page_object = get_page( $page_id ); echo '<h1>' . $page_object->post_title . '</h1>'; echo $page_object->post_content; } get_header(); ?> <main class="<?php echo omega_apply_atomic( 'main_class', 'content' );?>" <?php omega_attr( 'content' ); ?>> <?php do_action( 'omega_before_content' ); do_action( 'omega_content' ); do_action( 'omega_after_content' ); ?> </main><!-- .content --> <?php get_footer(); ?>There are many ways to do it but this is considered the fastest way to do and to explain 🙂
February 20, 2014 at 4:04 pm #1796uNeedShari
ParticipantThanks that worked, but now exactly as I need it to. For some reason my shortcodes quit working, but it’s got me started at least. Thanks!
February 21, 2014 at 1:19 am #1797han
Keymasterreplace
echo $page_object->post_content;
with
echo do_shortcode($page_object->post_content);February 21, 2014 at 8:48 pm #1799uNeedShari
ParticipantThanks I’ll give that a go 🙂
-
AuthorPosts
You must login to reply to this topic.
