douweng7233 2018-07-12 13:20
浏览 112

Wordpress Owl Carousel不显示自定义帖子类型

Trying to create an Owl Carousel (in Wordpress) that loops through user testimonials. The testimonials are added via custom post types in the wordpress dashboard. There is already content there for me to use and test.

The Owl Carousel has been registered in my custom script.js file and loop seems to working correctly. My issue that the loop seems to be pulling in the custom post types correctly and the owl carousel is being triggered in the browser.

However when I view the carousel in the browser none of the content appears. Viewing the source code shows the content but doesn't seem to display in the browser. Am i missing something completely obvious? Please help!

screen shot snippet when inspecting from browser

$("#footer-testimonials").owlCarousel({
        center: true,
        singleItem:true,
        loop:true,
        margin:10,
        autoplay: true,
        nav:true
    });
<div id="footer-testimonials" class="owl-carousel owl-theme">
        <?php while ( $testimonials->have_posts() ) : $testimonials->the_post();  ?>
          <?php 
            $content = get_the_content(); 
            if (strlen($content) > 200) {
              $summary = substr($content, 0, strrpos(substr($content, 0, 200), ' ')). '...';;
            } else{
              $summary = $content;
            }
          ?>

        <?php $link = get_permalink($testimonials->post->ID);?>
          <div class="item">
            <li class="" style="list-style-type: none;">
            <div itemprop="review" itemscope itemtype="http://schema.org/Review">
            <div class="testimonial-text">
              <a href="<?php echo $link ?>"><span itemprop="reviewBody"><?php echo $summary; ?> </span></a> 
             </div>
              <div class="slide-content">
                  <a itemprop="url" href="<?php echo $link ?>"><h3 class="testimonial-name text-center"><span itemprop="name"><?php the_title(); ?></span></h3></a>
              </div>
              </div>
              </li>
          </div>
        <?php endwhile; ?>
    </div> 

</div>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
    • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
    • ¥15 手机接入宽带网线,如何释放宽带全部速度