PHP WordPress Nivo滑块

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP WordPress Nivo滑块相关的知识,希望对你有一定的参考价值。

<div id="slider-container" class="grid_16">
  <div id="slider">

    <?php $custom_query = new WP_Query('post_type=slide&orderby=menu_order'); ?>
    <?php if ($custom_query->have_posts()): while ($custom_query->have_posts()): $custom_query->the_post(); ?>
    <?php $post_id = get_the_ID();	?>
        
    <a href="<?php meta('slide_url'); ?>">
      <?php
        $image_id = get_post_thumbnail_id();  
        $image_url = wp_get_attachment_image_src($image_id,'large');
        $image_url = $image_url[0];
        echo '<img src="' . $image_url . '" title="#caption-slide-' . $post_id . '"/>';
      ?>
    </a>

    <?php endwhile; else: ?>        
      <h2>Sorry...</h2>
      <p>No slides to display.</p>            
    <?php endif; wp_reset_query();?>

  </div><!-- #slider -->

  <?php $custom_query = new WP_Query('post_type=slide'); ?>
  <?php if ($custom_query->have_posts()): while ($custom_query->have_posts()): $custom_query->the_post(); ?>
  <?php $post_id = get_the_ID(); ?>

  <div id="caption-slide-<?php echo $post_id; ?>" class="nivo-html-caption <?php $text_placement = meta('text_placement'); $class = strtolower($text_placement); echo $class; ?>">
    <?php meta('slide_text'); ?>
  </div><!-- .nivo-html-caption -->
                    
  <?php endwhile; else: ?>        
    <h2>Sorry...</h2>            
  <?php endif; wp_reset_query();?>

  <div id="slider-flowers"></div>
</div><!-- #slider-container -->

以上是关于PHP WordPress Nivo滑块的主要内容,如果未能解决你的问题,请参考以下文章

如何将视频添加到 nivo 滑块?

如何用内容响应 Nivo 滑块?

将 Nivo Slider 更改为仅淡入淡出过渡

在 Nivo 滑块上播放/暂停按钮

Nivo 滑块链接不起作用

将动态文本动画添加到 nivo 滑块