Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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(); ?>
share|improve this question
    
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
add comment

1 Answer

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.

share|improve this answer
    
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 –  Yigit Ce. Yigit Jul 12 '13 at 11:57
    
Bump? Anyone? Bump? –  Yigit Ce. Yigit Jul 16 '13 at 19:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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