Site logo

[Resolved] After Content Hooks displays on Home Page too

Home Forums Support [Resolved] After Content Hooks displays on Home Page too

Home Forums Support After Content Hooks displays on Home Page too

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #284784
    Dave

    I was trying to add a short code to my after content hooks so it will just add to my full posts but it displays on my home page after each recent post which I don’t want it to. I just want it after the full post.

    #284785
    Leo
    Staff
    Customer Support

    Hi Dave,

    So you only want the hook to show up on single post pages? If so try adding this in the hook:

    <?php if ( is_single() ) : ?>
        Insert content here
    <?php endif; ?>

    Make sure Execute PHP is checked.

    Let me know if this answers your question.

    #285845
    Dave

    Hey Leo,

    That worked. Thanks!

    #285848
    Leo
    Staff
    Customer Support

    You’re welcome 🙂

    #739925
    Vijaykumar

    Hi tried above code for ‘After Content’ GP hook but it’s showing on only POSTS.
    I want to show it on PAGES as well.

    What changes do I need to do in the following code?

    <?php if ( is_single() ) : ?>
    Insert content here
    <?php endif; ?>

    #739961
    David
    Staff
    Customer Support

    Hi there,

    if you are using GP 1.7 then you can use the Hook Element – you won’t need the PHP condition as it has display rules built in:

    https://docs.generatepress.com/article/hooks-element-overview/

    #740092
    Vijaykumar

    perfect, your help is appreciated!

    #740124
    David
    Staff
    Customer Support

    You’re welcome

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘After Content Hooks displays on Home Page too’ is closed to new replies.