代码之家  ›  专栏  ›  技术社区  ›  max

如何更改jQuery滑块中的排序条件?

  •  1
  • max  · 技术社区  · 12 年前

    我正在尝试为Wordpress主题编辑此主题的模板: http://demo.fabthemes.com/financio/ 在“来自博客”容器中,我不想显示所有最新的条目。 既然我正在学习的道路上,我不需要一个确切的解决方案。我只需要有人给我指一个正确的方向。

    问题: 我如何更改我的代码,以便滑块显示特定标题中的条目? 我觉得我需要改变一些

    "$the_query->have_posts() ) : $the_query->the_post();"

    <div id="timer1" class="timer"></div>
     <div id="carslide">
      <?php $the_query = new WP_Query('posts_per_page=9' );
       while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
     <div class="post slidepost" id="post-<?php the_ID(); ?>">
       <?php
          $thumb = get_post_thumbnail_id();
          $img_url = wp_get_attachment_url( $thumb,'full' ); //get full URL to image (use "large" or "medium" if the images too big)
          $image = aq_resize( $img_url, 300, 150, true ); //resize & crop the image
       ?>
    <?php if($image) : ?>
      <a href="<?php the_permalink(); ?>">
       <img class="slide-image" src="<?php echo $image ?>"/>
      </a>
    <?php endif; ?>
        <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
      <?php wpe_excerpt('wpe_excerptlength_index', 'wpe_excerptmore'); ?>
      <div class="clear">
    </div>
    

    1 回复  |  直到 12 年前
        1
  •  1
  •   brianpeiris    12 年前

    我想你想改变 WP_Query('posts_per_page=9') 部分,以便显示与不同查询匹配的帖子。你可以阅读 reference for queries 了解更多信息。

    例如,如果您想显示特定类别中的五篇最新帖子,您可以使用 WP_Query('posts_per_page=5&cat=3')