【问题标题】:Add a captions to integrated FlexSlider on Wordpress Organictheme.在 Wordpress Organictheme 上为集成的 FlexSlider 添加标题。
【发布时间】:2013-08-24 04:47:40
【问题描述】:

想为 FlexSlider 添加一个标题,该标题已集成到购买的 Wordpress Organictheme 中。我相信必须修改幻灯片页面代码,虽然我在这里发现了一些类似的问题,但我还没有弄清楚(经过数小时和失败的尝试)究竟在哪里以及在现有代码中添加什么。似乎字幕应该是显而易见的!似乎它们应该以某种方式包含在

  • 标签???真的很感激一些帮助。 html,但不是 php 识字。谢谢你!

    代码需要放到这里的某个地方:

                <div class="flexslider">
    
                    <ul class="slides">
    
                        <?php $data = array(
                            'post_parent'       => $post->ID,
                            'post_type'         => 'attachment',
                            'post_mime_type'    => 'image',
                            'order'             => 'ASC',
                            'orderby'           => 'menu_order',
                            'numberposts'       => -1
                        ); ?>
    
                        <?php 
                        $images = get_posts($data); foreach( $images as $image ) { 
                            $imageurl = wp_get_attachment_url($image->ID);              echo '<li><img src="'.$imageurl.'"  /></li>' . "\n"; 
                        } ?>
    
                    </ul>
    
                </div>
    
  • 【问题讨论】:

      标签: wordpress flexslider caption


      【解决方案1】:

      确实,你们非常亲近。

      如果其他人需要,我会回答这个问题。缺少的两个代码是:

      <p class="flex-caption"><?php echo $caption; ?></p>
      

      ... flexslider 需要显示标题,并且

      $caption = $image->post_excerpt;
      

      ... 实际获取字幕。新代码是:

              <div class="flexslider">
      
                  <ul class="slides">
      
                      <?php $data = array(
                          'post_parent'       => $post->ID,
                          'post_type'         => 'attachment',
                          'post_mime_type'    => 'image',
                          'order'             => 'ASC',
                          'orderby'           => 'menu_order',
                          'numberposts'       => -1
                      ); ?>
      
                      <?php 
                      $images = get_posts($data);
                      foreach( $images as $image ) { 
                          $imageurl = wp_get_attachment_url($image->ID);
                          $caption = $image->post_excerpt;
                          echo '<li><img src="'.$imageurl.'"  /><p class="flex-caption">'.$caption.'</p></li>' . "\n";
                      } ?>
      
                  </ul>
      
              </div>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-12-23
        • 1970-01-01
        • 1970-01-01
        • 2018-05-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多