获取的数据进行两次页面上,我有我的主题page.php文件为:在WordPress
<?php /* The loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> >
<header class="entry-header">
<div class="hd"><?php the_title(); ?></div>
<?php if (has_post_thumbnail() && ! post_password_required()) : ?>
<div class="video"><?php the_post_thumbnail(); ?></div>
<?php endif; ?>
<div class="hd"><?php //the_title(); ?></div>
</header><!-- .entry-header -->
<?php the_content(); ?>
<?php wp_link_pages(array('before' => '<div class="page-links"><span class="page-links-title">' . __('Pages:', 'twentythirteen') . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>')); ?>
<!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link(__('Edit', 'twentythirteen'), '<span class="edit-link">', '</span>'); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
<?php // comments_template('', true); ?>
<?php endwhile; ?>
而且我在WordPress博客,图像和新闻进行了三次页面,我也赋予它们的类别为每个。现在我已经安装了php-exec插件。现在我正在编写一些php代码在页面编辑器检索博客数据...
它工作正常,但它提取数据两次,现在得到它是因为page.php。
所以我可以有一些page.php文件,如果条件我试图获取一些数据通过cotegory然后page.php文件数据不会显示...
这里是我的代码,我的应用博客网页编辑器
<?php if (query_posts('cat=63&showposts=5')) : ?>
<?php while (have_posts()) : the_post();
// do whatever you want
?>
<div class="gallery_views">
<div class="hd"><?php the_title(); ?></div>
<?php // get_template_part('content', get_post_format()); ?>
<?php // cup_post_nav(); ?>
<?php the_post_thumbnail(); ?>
<?php comments_template(); ?>
<b><a href="<?php the_permalink() ?>" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></b>
</div>
<?php endwhile; ?>
<?php else : ?>
在此先感谢..
将此添加到query_posts('post_type'=>'page')page.php上面while循环 – nickle