user3187469
user3187469

Reputation: 1521

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?

Upvotes: 0

Views: 1119

Answers (1)

cmorrissey
cmorrissey

Reputation: 8583

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

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

Upvotes: 1

Related Questions