【问题标题】:Navigation bar for pages in wordpresswordpress 中页面的导航栏
【发布时间】:2013-05-28 05:07:06
【问题描述】:

我想在 wordpress 中制作我的页面,显示类别。我已经想出了如何显示我想要的类别,像这样查询DB

<?php if ( have_posts() ) : ?>
<?php
query_posts('cat=7');
?> 

问题是当我将导航栏用于浏览页面时,它不起作用......它总是显示第一页......

这是我用于整个页面的代码。我使用Index.php 作为基础。

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

<?php get_header(); ?>

  <div class="container_16 clearfix">
  <div class="grid_16 grid_content_sidebar">  

   <div class="grid_11 alpha">
     <div id="content">   

    <?php get_template_part( 'loop-meta' ); ?>

    <?php if ( have_posts() ) : ?>
    <?php
 query_posts('cat=7');
 ?> 

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

        <?php get_template_part( 'content' ); ?>

      <?php endwhile; ?>

    <?php else : ?>

      <?php get_template_part( 'loop-error' ); ?>

    <?php endif; ?>

    <?php infinity_loop_nav(); ?>

  </div> <!-- end #content -->
</div> <!-- end .grid_10 -->

<?php get_sidebar(); ?>

</div> <!-- end .grid_16 -->

</div> <!-- end .container_16 -->

<?php get_footer(); ?>

我正在使用Infinity template。你能帮忙弄清楚导航栏的问题是什么,或者用其他方法来解决这个问题吗?

【问题讨论】:

    标签: php mysql wordpress wordpress-theming


    【解决方案1】:

    好的,我已经找到了问题所在。只需在查询行中添加这个

    .'&paged='.$paged
    

    现在看起来像这样

    <?php
    query_posts('cat=7'.'&paged='.$paged);
    ?> 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-07
      • 1970-01-01
      • 2022-09-23
      相关资源
      最近更新 更多