[Resolved] Hook after_content outside article

Home Forums Support [Resolved] Hook after_content outside article

Home Forums Support Hook after_content outside article

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1330660
    Philippe

    Hi, I want to use this code:

    <?php 
    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?

    Thanks.

    #1331579
    Tom
    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.

    #1331840
    Philippe

    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.

    #1331909
    Tom
    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.

    #1331942
    Philippe

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

    #1333105
    Tom
    Lead Developer
    Lead Developer

    Awesome ๐Ÿ™‚

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