[Resolved] Hook after_content outside article

Home Forums Support Hook after_content outside article

  • This topic has 5 replies, 2 voices, and was last updated 7 months ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #1330660

    Hi, I want to use this code:

    global $wp_query;
    if ($wp_query->current_post == 4) {
    	echo "AD";

    With after_content hook to show an ad after the 5th post in archives.

    It works, but I would like to have it outside the <article> so it’s not inside the box, but between the boxes. There is a hook or way to achieve that?


    Lead Developer
    Lead Developer

    Hi there,

    As of right now there is no hook there, so you’d need to alter the templates in a child theme.

    In 2.5.0, we’ve implemented a hook system for the content parts so this will be possible without altering files.


    Thanks for the quick reply.

    2.5.0 is in beta stage? That sounds good!

    Regarding child theme, there is a way to do it with the Code Snippets plugin?
    If not, I’ve seen that you recommend an ad inserter plugin. However, the ones I’ve tested use jQuery and I can’t use it because my site has AMP. Do you know of a plugin that can do this without using extra Javascript?

    If not, I will go with the child theme route. What happens with it if there is a theme update?

    Thanks again.

    Lead Developer
    Lead Developer

    2.5.0 is still in development, so not quite in alpha yet.

    You can use a child theme, you’ll just want to watch when 2.5.0 is released and update the file/scrap it and use the hook method.


    Thanks, I was able to do it with the child theme πŸ™‚

    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.