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.

have a little problem. I'm currently creating a theme, where the article page is not on the home page. The trouble now is that on the home page below are three content boxes and they should not appear on the article page.

I created a blog page template (blog.php) and created a new page and inserted the blog page template there.

The blog page template references in the source to a loop (loop-blog.php) where the content to be displayed is.

Neither the blog.php or the loop-blog.php have anything from the code that is responsible for the content boxes but still I see the content boxes on the article page.

Content of blog.php:

    <?php /* Template Name: Blog */ ?>
<?php get_header(); ?>

<!-- Example row of columns -->
<div class="row-fluid">
    <div class="span11">

        <?php if ( ! have_posts() ) : ?>
        <header>
            <h1>Nicht gefunden!</h1>
        </header>

        <p>Sorry, leider konnte der gew&uuml;nschte Artikel nicht gefunden werden. Vielleicht hilft dir die suche ja weiter!</p>

        <?php endif; ?>

        <?php while ( have_posts() ) : the_post(); ?>

        <?php get_template_part( 'blog', 'loop-blog' ); ?>


        <?php endwhile; ?>

        <?php if(function_exists('wp_paginate')) {
        wp_paginate();
        } ?>

        <hr>
    </div>
</div>

<?php get_footer(); ?>

Content of the loop-blog.php

 <div class="content">
            <div class="page-header">
                <a href="<?php the_permalink(); ?>"><h1><?php the_title(); ?></h1></a>
                <br>
                <p><?php the_time('j. F Y'); ?> | <?php the_author_posts_link(); ?> | Ver&ouml;ffentlicht unter: <?php the_category(', ') ?> | <?php comments_popup_link('keine Kommentare', '1 Kommentar', '% Kommentare', 'comments-link', 'Kommentarfunktion deaktiviert'); ?></p>
            </div>
            <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                <?php the_excerpt(); ?>
            <?php else : ?>
                <?php the_content('Weiterlesen'); ?>
            <?php endif; ?>
        </div>
        <hr>

The categories was made in the same way, and here it works as it should. The content boxes are not displayed. I'm a bit stumped here, where is the mistake?

share|improve this question
    
read codex.wordpress.org/Function_Reference/get_template_part - you have some naming confusion with your template part. do you have a link to the problem site to illustrate what 'content boxes' are showing? –  Michael Sep 8 '12 at 17:02
    
Hey! Here is a link: hazelnut.cygnus.uberspace.de/wordpress –  hazelnut Sep 9 '12 at 14:12
    
have you checked the naming of the template? your 'get_template_part()' code would look for a blog-loop-blog.php template. not being able to find this, it will use blog.php. –  Michael Sep 9 '12 at 15:19
    
Thank you! I didn't see that mistake. I have fixed it. :-) –  hazelnut Sep 9 '12 at 21:27
add comment

1 Answer

up vote 1 down vote accepted

Take a look at the Template Hierarchy. You most likely want to use home.php as the name of your custom post page.

share|improve this answer
    
That worked .. Thank You! :> –  hazelnut Sep 9 '12 at 21:27
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.