duankeng1911 2015-03-13 17:49
浏览 14

在第一张图片之后,在Wordpress的图库短信中添加摘录

I have a gallery that is a scrolling collection of the images using this short code

[gallery itemtag="div" icontag="span" captiontag="p" link="none" size="full" columns="0"]

EXAMPLE OF GALLERY PAGER:

http://rc2.jaywolfe.com/cars-for-sale/2013-toyota-land-cruiser-base-t30061/

Need to add content JUST after/between the first and second image. I've been able to use this or variant of in other applications but since its within a shortcode I'm struggling to get it.

<?php $counter = 0; ?>
[gallery itemtag="div" icontag="span" captiontag="p" link="none" size="full" columns="0"]
        <?php if ($counter % 4 == 3): /* ADD THIS */ ?>
<div>test</div>
<?php endif; ?>

              <?php $counter++ ?>

Any guidance would be greatly appreciated.

  • 写回答

1条回答 默认 最新

  • dongwei1234 2015-07-01 21:02
    关注

    Ended up finding this worked for me. Just added it to my functions.php file and called the new short code as needed.

    function jw_vdp_gallery() {
        ob_start();
    $id = get_post_thumbnail_id(get_the_ID()); // gets the post thumbnail ID
    echo do_shortcode('[gallery exclude='.$id.' itemtag="div" icontag="span" captiontag="p" link="none" size="full" columns="0"]');
    
    $output_string = ob_get_contents();  
    ob_end_clean();  
    return $output_string; 
    } 
    add_shortcode( 'vdp-gallery', 'jw_vdp_gallery' );
    
    评论

报告相同问题?

悬赏问题

  • ¥15 WPF 大屏看板表格背景图片设置
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示