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'm using the blogolife-theme on wordpress 3.6.1 my template looks like this:

<?php
/*
Template Name: Template One
*/
?>

<?php
/**
 * A custom template file.
 * @package WPLOOK
 * @subpackage BlogoLife
 * @since BlogoLife 1.0
 */
get_header(); 
$hasSidebar = "";
$sidebar =    get_post_meta($post->ID,'wpl_enable_sidebar',true);
get_template_part('content', 'page' ) ;
//get_template_part('inc', 'indexloop' ) ;
if($sidebar=="false" ) {
echo '<div class="clear"></div>';
} else {

get_sidebar(one);

}
get_footer(); ?>

the content-page.php looks like this:

<?php
/**
 * The default template for displaying content
 *
 * @package wplook
 * @subpackage BlogoLife
 * @since BlogoLife 1.0
 */
?>
<div class="primary">
<div id="content">
        <?php wplook_doctitle(); ?>
        <?php if ( have_posts() ) : ?>
        <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <div class="col1 fleft">
            <div class="postformat">
                <div class="format-icon"></div>
                <div class="left-corner"></div>
            </div>
        </div>
        <div class="col2 fright">       
    <header class="entry-header">
                    <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wplook' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1></header>
    <div class="entry-content">
        <?php the_content(); ?>
        <?php wp_link_pages( array( 'before' => '<div class="clear"></div><div class="page-link"><span>' . __( 'Pages:', 'wplook' ) . '</span>', 'after' => '</div>' ) ); ?>
        <!-- .entry-content -->
    <div class="clear"></div>   
        <div class="entry-utility">
        <?php if ( the_category ( '', ', ' ) ) { ?>
            <div class="category">
                <b><?php _e('Category:', 'wplook'); ?></b>
                <?php the_category(', ') ?>
                <div class="end"></div>
            </div>
            <?php } ?>
            <?php if ( get_the_tag_list( '', ', ' ) ) { ?>
            <div class="tag"> 
                <b><?php _e('Tag:', 'wplook'); ?></b>
                <?php echo get_the_tag_list('',', ',''); ?>
                <div class="end"></div>
            </div>
            <?php } ?>

        </div>
    <div class="clear"></div>
    </div><!-- .entry-content -->
        <footer class="entry-meta">
            <div class="date-i fleft"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wplook' ), the_title_attribute( 'echo=0' ) ); ?>" rel="nofollow"><?php wplook_get_date_time();?></a></div>
            <?php if ( comments_open() ) : ?>
                <div class="comment-i fleft"><?php comments_popup_link(__('No comments', 'wplook'), __('1 comment', 'wplook'), __('% comments', 'wplook'), 'comments-link', __('Comments off', 'wplook')); ?></div>
            <?php endif; ?>
            <div class="author-i fleft"><?php wplook_get_author();?></div>
            <?php edit_post_link( __( 'Edit', 'wplook' ), '<div class="edit-i fright">', '</div>' ); ?>
            <div class="clear"></div>
        </footer>
    </div>
    <div class="clear"></div>
</article>  
                <?php comments_template( '', true ); ?>
            <?php endwhile; ?>
        <?php endif; ?>
</div><!-- #content -->
</div><!-- #primary -->

but nothing is happening. my index.php used

get_template('inc' 'indexloop' ) ;

which showed all entries, but when i use this function on my custom template, also nothing appeares.

btw. this is my not modified index.php, the modified works the same, only has some edits:

<?php
/**
 * The main template file.
 *
 * @package WPLOOK
 * @subpackage BlogoLife
 * @since BlogoLife 1.0
*/
get_header();
get_template_part('inc', 'indexloop' ) ;
get_sidebar();
get_footer(); ?>
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

With this code:

get_template_part('content', 'page' );

Wordpress will try to load a file called content-page.php and if this file doesn't exist then it will try to load content.php. Your theme seems to have the file content-page.php, so if you want to load content.php you should use:

get_template_part('content');

EDIT: You have edited the question and delete the code with this issue with the get_template_part(). I think is better keep the original code in the question and, in any case, add the new code with new comments.

About why the content-template is not showing any blog-entries: if you are using the template as you have posted and it is a template for a 'page' (as the name content-page.php suggests as well the name page-one.php where you said it dosen't work), you need to run some code to get the posts you want to show before starting the loop; the query made by Wordpress was only the query needed to get the actual 'page'. A quick example:

<div class="primary">
    <div id="content">
        <?php wplook_doctitle(); ?>
        <?php
        // See the docu for more arguments: http://codex.wordpress.org/Class_Reference/WP_Query
    $the_query = new WP_Query('showposts=5' . '&paged='.$paged);
        if ( $the_query->have_posts() ) : ?>
            <?php /* Start the Loop */ ?>
            <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                   <div class="col1 fleft">
                       <div class="postformat">
                           <div class="format-icon"></div>
                            <div class="left-corner"></div>
                       </div>
                   </div>
                   <div class="col2 fright">       
                       <header class="entry-header">
                           <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wplook' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
                       </header>
                       <div class="entry-content">
                           <?php the_content(); ?>
                           <?php wp_link_pages( array( 'before' => '<div class="clear"></div><div class="page-link"><span>' . __( 'Pages:', 'wplook' ) . '</span>', 'after' => '</div>' ) ); ?>
                           <!-- .entry-content -->
                           <div class="clear"></div>   
                          <div class="entry-utility">
                          <?php if ( the_category ( '', ', ' ) ) { ?>
                              <div class="category">
                                  <b><?php _e('Category:', 'wplook'); ?></b>
                                  <?php the_category(', ') ?>
                                  <div class="end"></div>
                              </div>
                          <?php } ?>
                          <?php if ( get_the_tag_list( '', ', ' ) ) { ?>
                              <div class="tag"> 
                                  <b><?php _e('Tag:', 'wplook'); ?></b>
                                  <?php echo get_the_tag_list('',', ',''); ?>
                                  <div class="end"></div>
                              </div>
                          <?php } ?>

                      </div>
                      <div class="clear"></div>
                  </div><!-- .entry-content -->
              <footer class="entry-meta">
                  <div class="date-i fleft"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'wplook' ), the_title_attribute( 'echo=0' ) ); ?>" rel="nofollow"><?php wplook_get_date_time();?></a></div>
                   <?php if ( comments_open() ) : ?>
                       <div class="comment-i fleft"><?php comments_popup_link(__('No comments', 'wplook'), __('1 comment', 'wplook'), __('% comments', 'wplook'), 'comments-link', __('Comments off', 'wplook')); ?></div>
                   <?php endif; ?>
                       <div class="author-i fleft"><?php wplook_get_author();?></div>
                       <?php edit_post_link( __( 'Edit', 'wplook' ), '<div class="edit-i fright">', '</div>' ); ?>
                   <div class="clear"></div>
               </footer>
           </div>
       <div class="clear"></div>
   </article>

    <?php endwhile; ?>
    <?php endif; ?>
    <?php wp_reset_postdata(); ?>
</div><!-- #content -->
</div><!-- #primary -->
share|improve this answer
1  
This is not worded entirely correctly. It will look for content-page.php, then content.php if former is not available. Since theme in question does seem to have content-page.php that's probably what gets loaded indeed. –  Rarst Sep 20 '13 at 13:19
    
thx, didn't knew this, i changed the code... btw. problem occures also when i gonna use only 'content' (but with a format issue) take a look by yourselfe: svs03.azurewebsites.net (E1 = content-page.php, E2 = content.php) –  Raymond Osterbrink Sep 20 '13 at 13:28
    
That is a a different problem about your HTML/CSS. –  cybnet Sep 20 '13 at 13:37
    
also i tested "the get_template_part('inc', 'indexloop' ) ;" function inside the index.php again, which was working fine, but not in the page-one.php, but i don't see any differences. –  Raymond Osterbrink Sep 20 '13 at 13:37
    
Your question was about loading a template part and it has been ansered correctly. You should accept the answer and make a new question if you have a new and different problem. Comments are not a good place to make new questions as it is difficult to follow. –  cybnet Sep 20 '13 at 14:07
show 3 more comments

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.