我已经尝试了几个代码来显示我创建的主题中的WordPress帖子,但没有任何效果 - 为什么?
<?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 »', '1 Comment »', '% Comments »'); ?>
</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; ?>
什么都没有显示帖子为什么?我的主题中有以下文件:index.php,header.php,style.css,footer.php,page.php,single.php
答案 0 :(得分:0)
self.webView.scrollView.maximumZoomScale = 1.0;
self.webView.scrollView.minimumZoomScale = 1.0;
请在上面的If语句中添加此代码。
答案 1 :(得分: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 »', '1 Comment »', '% Comments »'); ?>
</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; ?>