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 copied TwentyEleven and used all its resources to start, I've done all the steps, added my own widgets, menus, css, js and all but I'm stuck with this issue:

I set the front page to be static and set a page for it (it has content in it), also set a blank page for the blog posts. The theme just shows the pages as blank for both in all situations unless I specify a wrong file name in which it will show the 'Not found' text.

I'm sure I'm doing something horribly wrong, but what?

Here's the part that loads the content in index.php:

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>

                <?php get_template_part( 'content', get_post_format() ); ?>

            <?php endwhile; ?>

        <?php else : ?>

            <article id="post-0" class="post no-results not-found">
                <header class="entry-header">
                    <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
                </header><!-- .entry-header -->

                <div class="entry-content">
                    <p><?php _e( 'Page not found.', 'twentyeleven' ); ?></p>
                </div><!-- .entry-content -->
            </article><!-- #post-0 -->

        <?php endif; ?>
share|improve this question
1  
Do you see the header and footer part at least? or just a blank screen? –  Vasanthan.R.P Feb 9 '12 at 6:41
    
Yes, I do. I added the footer and header tags correctly and they work as they should. But no content in the middle. The code doesn't work at all there, doesn't show any blog content or single pages. Just blank in the middle. –  Ano Madadi Feb 9 '12 at 11:20
add comment

migrated from stackoverflow.com Feb 9 '12 at 17:24

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 3 down vote accepted

First of all Create Template and Assign Template to Static page to which u have to display as a home page. Example of template:

<?php
/**
* Template Name: Home Page Template
*
*/
get_header();
?>
<div class="mid-part cm-fl">
<div id="container">
<div id="content" role="main">
<div class="left-section">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="body-top"></div>
<div class="entry-content body-content">
<h2 class="entry-title"><?php the_title(); ?></h2>                  
<?php the_content(); ?>                 
</div>
<div class="body-bottom"></div>
</div>

<?php endwhile; ?>
</div>
</div>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
share|improve this answer
    
That did it! You're awesome! Now I only need to correct the styling and it's all good to go. Thanks a ton! –  Ano Madadi Feb 9 '12 at 11:41
    
First, this shouldn't be necessary, if index.php is present, since it is the default fallback. Second, it's generally a bad idea to conflate the Home page (i.e. the Blog Posts Index) with the Front Page (i.e. the Site Front Page). Third, if you specifically need a site front page template, the correct template to use is front-page.php. No need to add a Template: phpDoc comment, as WordPress will use the template file appropriately, automatically. –  Chip Bennett Feb 9 '12 at 17:55
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.