简体   繁体   中英

How to include HTML and [shortcode] inside PHP?

I have a wordpress website and I want to display this at the end of every blog post:

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

If I add this to single.php which shows the pages I want to modify, the shortcode won't work.

<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 -->

Is there a workaround for this?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM