2016-05-04 11 views
0

Ich habe verschiedene Codes versucht, WordPress Posts in meinem Thema anzuzeigen, ich erstelle, aber nichts funktioniert - warum?WordPress Posts werden überhaupt nicht angezeigt

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

     <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 

      <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> 

      <?php include (TEMPLATEPATH . '/inc/meta.php'); ?> 

      <div class="entry"> 
       <?php the_content(); ?> 
      </div> 

      <div class="postmetadata"> 
       <?php the_tags('Tags: ', ', ', '<br />'); ?> 
       Posted in <?php the_category(', ') ?> | 
       <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> 
      </div> 

     </div> 

    <?php endwhile; ?> 

    <?php include (TEMPLATEPATH . '/inc/nav.php'); ?> 

    <?php else : ?> 

     <h2>Not Found</h2> 

    <?php endif; ?> 
<?php 

if (have_posts()) : 
    while (have_posts()) : 
     the_post(); 
     the_content(); 
    endwhile; 
endif; ?> 

Nichts zeigt die Beiträge warum? Ich habe die folgenden Dateien in meinem Thema: index.php, header.php, style.css, footer.php, page.php, single.php

+2

Werden Ihre Seiten wie erwartet angezeigt? Erhalten Sie einen weißen Bildschirm, wenn Sie versuchen, Beiträge anzuzeigen? Haben Sie Ihr Fehlerprotokoll überprüft? –

Antwort

0
<?php 
    query_posts(array( 
     'post_type' => 'YOUR_POST_TYPE_NAME', // Add your post-type name 
     'showposts' => 10 
    )); 
?> 

Bitte diesen Code in Ihrer obigen If-Anweisung hinzufügen.

0
<?php 
$args = array(
'post_type' => 'post', 
'post_status'=>'publish' 
); 
$wpquery = new WP_Query($args);  
if ($wpquery->have_posts()) : while ($wpquery->have_posts()) : $wpquery->the_post(); ?> 

<div <?php post_class() ?> id="post-<?php the_ID(); ?>"> 

<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> 

<?php include (TEMPLATEPATH . '/inc/meta.php'); ?> 

<div class="entry"> 
    <?php the_content(); ?> 
</div> 

<div class="postmetadata"> 
    <?php the_tags('Tags: ', ', ', '<br />'); ?> 
    Posted in <?php the_category(', ') ?> | 
    <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?> 
</div> 

</div> 

<?php endwhile; ?> 

<?php include (TEMPLATEPATH . '/inc/nav.php'); ?> 

<?php else : ?> 

<h2>Not Found</h2> 

<?php endif; ?> 
<?php 

if ($wpquery->have_posts()) : 
while ($wpquery->have_posts()) : 
the_post(); 
the_content(); 
endwhile; 
endif; ?> 
Verwandte Themen