0

I've created a page named "homepage", set the page as front page from Reading > Static Page > Front page and it's nearly working fine. The issue I'm having the blog posts aren't included into the page. It comes with the blank page and I need to change order as "menu_order", not working.

In other words, I need to get the pages in order as same as the navigation.

<?php
/**
 * The main template file.
 *
 * Template Name: One
 */

get_header();

$pages = get_posts(array(
    'posts_per_page' => -1,
    'post_type' => 'page',
    'order' => 'ASC'
));

foreach($pages as $_post) {
    $content = apply_filters('the_content', $_post->post_content);
    $title = $_post->post_title;
    $slug = $_post->post_name;
    ?>

-div class content-

<?php
}
get_footer(); ?>
  • The previous title didn't make sense. But I'm not sure I've captured the issue in the new one. What does not work: blog posts not showing or pages not in the correct order? – brasofilo Jul 12 '13 at 2:48
0

If you want the page to display your blog posts then you need to either change the front page reading option to latest posts then use either index.php or create a new file named front-page.php.

If you want your page query ordered by menu_order you need to add 'orderby' => 'menu_order' to the query.

  • First of all, than you for the answer. Secondly, when I change the front page settings, I can view the blog post but can't view other pages. What I need to view both blog posts and pages at the front page. By the way, navigation issue still persists. Current navigation order is :services/about/portfolio/contact/blog but what i get after adding the code you've suggested is :about/contact/blog/services/portfolio – Ji't Jul 12 '13 at 11:57
  • Bump? Anyone? Bump? – Ji't Jul 16 '13 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.