Adding Author to bottom of all posts (part 2)

Hey. I had a forum question where I asked how to put Authors at the bottom of posts and it was answered with this -

function add_author() {
if(is_singular(‘post’)){
$author_id = get_the_author_meta(‘ID’);
echo do_shortcode(’[author title=“About the Author” author_id="’.$author_id.’"]’);
}
}
add_action( ‘x_before_the_content_end’, ‘add_author’, 10 );

to put into the functions.php file on my child theme.

however, this puts is BELOW the revolution slider add-on ‘Related Posts slider’.

How can I have it ABOVE the rev slider add-on?

example --> https://intothemythica.com/the-delightful-psyche/

Hi there,

In that case, try adding the following Javascrupt code into your Theme Options > Global Javascript area.

jQuery(function() {
  jQuery( ".x-author-box.cf" ).insertBefore( "#rev_slider_45_1_wrapper" );
});

Hope that helps.

That works perfectly. Thank you.

What if I want to remove the automatic Author aspect on specific posts?

(I’m tweaking a design, obviously)

Hi There,

Please update your code to this:

function add_author() { 
  if( is_singular('post') && !is_single( array(474, 123) ) ){
    $author_id = get_the_author_meta('ID');
    echo do_shortcode('[author title="About the Author" author_id="'.$author_id.'"]');
  }
}
add_action( 'x_before_the_content_end', 'add_author', 10 );

The 474, 123 numbers are the post ID.

Hope it helps :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.