0

I have an About the Author plugin, echoing inside the_content(), and a Facebook Like Button, that I hardcoded in the HTML, after the_content(), here's how it is outputting:

enter image description here

The Facebook Like button should appear prior than the Author Box

Single.php (handcoded by me, probably with some bad practices as I'm noob at PHP):

<?php get_header(); ?>
<div class="fb-recommendations-bar" data-site="criatweb.com" data-trigger="50%" data-read-time="10" data-side="right" data-action="like"></div>
    <div class="blog roundedall" style="margin-bottom:10px;">
    <div class="bcontainer contentpadded">
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            <h1 class="blog-title"><?php the_title(); ?></h1>
            <h4 class="blog-author">por <?php the_author_link(); ?> </h4>
            <h3 class="blog-categories">Em <?php the_category(' , ') ?></h3>
            <p><?php the_content(); ?></p>
            <div class="blog-subfooter">
                <div class="fb-like" data-layout="button_count" data-action="like" data-show-faces="false" data-share="false"></div>
            </div>
            <hr>
            <?php echo do_shortcode('[fbcomments width="450" count="on" num="10" title="Faça o social :)" countmsg="comments"]'); ?>
        <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?>
    </div>
    </div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

I know why it is outputting bellow the author box, but I don't know how to FIX it.

I've tried do_shortcode the Biographia plugin, but then it enters a infinite loop, echoing the post over and over again

  • Can you provide a link to the About the Author plugin? ... or is it the Biographia plugin? – birgire Nov 29 '13 at 15:07
  • It is the Biographia plugin! – Lucas Bustamante Nov 29 '13 at 15:18
1

You could try to add the Facebook-Like html code via this filter:

/**
 * Append Facebook Like to the content
 *
 * @param string $content
 * @return string $content
 */
function custom_the_content( $content )
{
    $fblike = '<div class="fb-like" 
                    data-layout="button_count" 
                    data-action="like" 
                    data-show-faces="false" 
                    data-share="false">
              </div>';

    return $content . $fblike;
}

add_filter( 'the_content', 'custom_the_content', 9, 1 );

if the priority of the author box is 10.

Otherwise you could adjust the priority via the Biographia settings page:

Biographia settings page

so you would have:

priority("facebook like") < priority("author box")
  • Thank you, it works! It's great to learn about adding custom code to the_content, real useful – Lucas Bustamante Nov 29 '13 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.