duanjiyun7391 2013-04-28 21:17
浏览 82
已采纳

WordPress包裹div里面的echo shortcode php

I'm trying to wrap a div using a shortcode that I'm calling from within my themes template.

So far I have this:

<?php echo do_shortcode('[tooltip content="Delete" url=""]'.<div class="delete-button-comments"><?php if ( bp_activity_user_can_delete() ) bp_activity_delete_link(); ?></div>.'[/tooltip]'); ?>

but I'm getting a syntax error (which I know why) but if I delimit the periods and apostrophes nothing happens at all.

So basically I would like to wrap the tooltips shortcode around the div that displays the icon that the div displays.

  • 写回答

1条回答 默认 最新

  • duandi1636 2013-04-28 21:46
    关注

    bp_activity_delete_link echoes the link, you should use bp_get_activity_delete_link() to return the value. Not exactly sure what you're trying to do, maybe something like:

    <?php
        $link = ( bp_activity_user_can_delete() ) ? '<div class="delete-button-comments">' . bp_get_activity_delete_link() . '</div>' : '';
        echo do_shortcode('[tooltip content="Delete" url=""]' . $link . '[/tooltip]');
    ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料