如何在PHP中包含HTML和[shortcode]?

时间:2014-03-14 17:08:59

标签: php wordpress

我有一个wordpress网站,我想在每篇博文的末尾显示:

<h5 style="margin-bottom: 15px;margin-top:35px;"><em><strong>Text:</strong></em>
[shareaholic app="share_buttons" id="5374371"]  

如果我将此添加到single.php,它显示我想要修改的页面,则短代码将无效。

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

        <?php
        /* Featured Image */
        if(has_post_thumbnail()) { ?>
        <p class="post-thumbnail">
            <?php the_post_thumbnail('full'); ?>
        </p>
        <?php } 

        the_content();

        the_tags('<p>'.__('Tags:', 'sntheme'),', ','</p>');

        /* Show post page links */
        wp_link_pages( array( 'before' => '<p>' . __( 'Pages:', 'sntheme' ), 'after' => '</p>' ) ); 
        ?>
          <h5 style="margin-bottom: 15px;margin-top:35px;"><em><strong>Text:</strong></em>
[shareaholic app="share_buttons" id="5374371"]
    </article><!-- end post -->

有解决方法吗?

1 个答案:

答案 0 :(得分:1)

是 - http://wordpress.org/plugins/shareaholic/installation/

<?php echo do_shortcode ('[shareaholic app="share_buttons" id="5374371"]'); ?>