2019-11-11T15:49:21.png

轮翻文件路径:

/ripro/parts/home-mode/slider.php

直接复制文档里面的代码替换slider里面的代码

<?php

$mode_slider = _cao('mode_slider');

$args = array(
    'cat'       => $mode_slider['category'],
    'ignore_sticky_posts' => true,
    'post_status'         => 'publish',
    'posts_per_page'      => $mode_slider['count'],
    'offset'              => $mode_slider['offset'],
    'orderby'              => $mode_slider['orderby'],
);


$data = new WP_Query($args);

if ($mode_slider['is_styles_rand']) {
    $mode_slider_style = mt_rand(0,1);
}else{
    $mode_slider_style = $mode_slider['styles'];
}
ob_start(); ?>

<?php if ($mode_slider_style == '1') : ?>
<div class="section banner-17codesign">
    <div class="container">
        <div class="module slider big owl nav-white<?php echo esc_attr( $mode_slider['autoplay'] ? ' autoplay' : '' ); ?>">
        <?php if ($mode_slider['diy_slider']) : ?>
            <?php foreach ($mode_slider['diy_data'] as $key => $item) {
              echo '<article class="post lazyload visible" data-bg="'.esc_url( $item['_img'] ).'">';
                echo '<a'.( $item['_blank'] ? ' target="_blank"' : '' ).' class="u-permalink" href="'.esc_url( $item['_href'] ).'"></a>';
              echo '</article>';
          } ?>
        <?php else : ?>
          <?php while ( $data->have_posts() ) : $data->the_post();
            $bg_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' ); 
            $bg_image_src = ($bg_image) ? $bg_image[0] : _the_theme_thumb_full();
            ?>
            <article <?php post_class( 'post lazyload visible' ); ?> data-bg="<?php echo esc_url( $bg_image_src ); ?>">
              <div class="entry-wrapper">
                <?php cao_entry_header( array( 'tag' => 'h2', 'link' => false, 'white' => true, 'category' => true,'author'=>true ) ); ?>
                <?php if ( $_get_excerpt = _get_excerpt(120) ) : ?>
                  <div class="entry-excerpt u-text-format">
                    <?php echo $_get_excerpt; ?>
                  </div>
                <?php endif; ?>
                <?php get_template_part( 'parts/entry-footer' ); ?>
              </div>
              <a<?php echo _target_blank();?> class="u-permalink" href="<?php echo esc_url( get_permalink() ); ?>"></a>
            </article>
          <?php endwhile; ?>
        <?php endif; ?>
        </div>
    </div>
</div>
<?php else : ?>
<div class="section bgcolor-fff pt-0">
    <div class="module slider center owl<?php echo esc_attr( $mode_slider['autoplay'] ? ' autoplay' : '' ); ?>">

      <?php if ($mode_slider['diy_slider']) : ?>
        <?php foreach ($mode_slider['diy_data'] as $key => $item) {
            echo '<article class="post lazyload visible" data-bg="'.esc_url( $item['_img'] ).'">';
              echo '<a'.( $item['_blank'] ? ' target="_blank"' : '' ).' class="u-permalink" href="'.esc_url( $item['_href'] ).'"></a>';
            echo '</article>';
        } ?>
      <?php else : ?>
        <?php while ( $data->have_posts() ) : $data->the_post();
          $bg_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' ); 
          $bg_image_src = ($bg_image) ? $bg_image[0] : _the_theme_thumb_full();
          ?>
          <article <?php post_class( 'post lazyload visible' ); ?> data-bg="<?php echo esc_url( $bg_image_src ); ?>">
            <div class="entry-wrapper">
              <?php cao_entry_header( array( 'tag' => 'h2', 'link' => false, 'white' => true, 'category' => true ,'author'=>true) ); ?>
              <?php if ( $_get_excerpt = _get_excerpt(120) ) : ?>
                <div class="entry-excerpt u-text-format">
                  <?php echo $_get_excerpt; ?>
                </div>
              <?php endif; ?>
              <?php get_template_part( 'parts/entry-footer' ); ?>
            </div>
            <a<?php echo _target_blank();?> class="u-permalink" href="<?php echo esc_url( get_permalink() ); ?>"></a>
          </article>
        <?php endwhile; ?>
      <?php endif; ?>
      
    </div>
</div>
<?php endif; 
$site_notify_text = _cao('site_notify_text','');
if ($site_notify_text) : ?>

<?php endif; ?>
<?php
wp_reset_postdata();
echo ob_get_clean();
Last modification:November 11, 2019
如果觉得我的文章对你有用,请随意赞赏