Where to add code at end of blog post?

Hi,

I’d like to add some code at the very end of the blog post on all post types. If you see here I’d like it to appear before “Please share this post…”, which is something I added a while ago. However it’s been a while since I did this and I don’t remember which file it is!

wp-single.php makes a call to

<?php x_get_view( 'renew', 'content', get_post_format() ); ?><br /><br />
<div style="margin-bottom:50px float:left"><?php previous_post_link('%link', '&laquo;&laquo; Previous   Post'); ?> </div>

… which looks like it should be in content.php, but content.php doesn’t contain the layout of a single page and neither can I see the other code I’d added in the past. I’m a bit baffled!

My child theme contains files for the Renew layout.

Hi @demonboy,

Thank you for writing in, you can use the action x_before_the_content_end to hook something on the bottom of the post’s content.

It’s possible that your SHARE THIS POST shortcode is added using this method, check your child theme’s functions.php file.

Hope it helps,
Cheers!

Hi @friech,

So would this work?

function ftbmateslinks ( $content ) {
  if ( is_singular('post') ) {
    echo do_shortcode('[myshortocde]');
  }
}
add_action('x_before_the_content_end', 'ftbmateslinks');

Hello @demonboy,

Yes, your code should work to display the shortcode at the bottom of the blog post.

Please note that custom coding is outside the scope of our support. Issues that might arise from the use of custom code and further enhancements should be directed to a third party developer.

Best Regards.

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