多个post_type wordpress

时间:2019-03-18 08:46:09

标签: php wordpress-theming custom-post-type

我从主题中获得了这段代码,该代码结果显示了1种帖子类型的滑块,我希望使其显示2/3个自定义帖子。
如何更改此代码?

代码如下:

<div class="carousel" data-flickity='{ "autoPlay": true,"wrapAround": true }'>
  <?php 
  $recent = new WP_Query("post_type=anime&showposts=12&orderby=rand"); 
  while($recent->have_posts()) : $recent->the_post(); 
  ?>
    <a class="series" rel='<?php the_ID(); ?>' href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
      <?php if ( has_post_thumbnail() ) { ?>
        <?php the_post_thumbnail('',array('title' => ''.get_the_title().'')); ?>
      <?php } else { ?>
        <img height='140!important' src="<?php echo get_image(); ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" />
      <?php } ?>
      <div class="ctl">
        <h2>
          <?php the_title(); ?>
        </h2>
      </div>
      <span class='tipi3'>
        <i class="fa fa-television"></i> 
        <?php 
          $meta = get_post_meta( get_the_ID(), 'smoke_type', true ); 
          echo $meta; 
        ?>
      </span>
      <span class='tipi2'>
        <i class="fa fa-star"></i> 
        <?php 
          $meta = get_post_meta( get_the_ID(), 'smoke_rate', true ); 
          echo $meta; 
        ?>
      </span>
    </a>
  </div>
  <?php wp_reset_postdata(); ?>
  <?php endwhile; ?>
</div>

0 个答案:

没有答案