[Resolved] "After Content" hook is displayed below every item on search results page

Home Forums Support [Resolved] "After Content" hook is displayed below every item on search results page

Home Forums Support "After Content" hook is displayed below every item on search results page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #611020
    Dominique

    Hi,

    I use the ‘after content’ hook to help with site navigation and to display ads. It all works fine except that the hook’s content appears below every item in the search results page.

    So my search results page is a list of:
    – Page Title
    – Excerpt (read more)
    – Hook

    – Page Title
    – Excerpt (read more)
    – Hook

    Is there a way to fix that behaviour so that the hook is not displayed in the results page below every item?

    I thought of using the ‘Before Footer’ hook instead but that is not ideal for a variety of reasons…

    GeneratePress 2.1.2
    GP Premium 1.6.2
    #611051
    David
    Staff
    Customer Support

    You can wrap the content inside the hook within a conditional tag:

    https://docs.generatepress.com/article/using-hooks-conditional-tags/

    An example for displaying it only on the a page or a single post can be achieved like so:

    <?php if ( is_single() || is_page() ) : ?>
        This Content will ONLY show in single posts or pages.
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.