[Support request] Content below Posts on category page

Home Forums Support Content below Posts on category page

This topic contains 38 replies, has 4 voices, and was last updated by  Sonja 1 month ago.

Viewing 15 posts - 1 through 15 (of 39 total)
  • Author
    Posts
  • #1007094

    Sonja

    Hello,

    On a category page, there are teasers of the posts. Now I want content below these teasers, but only on first page and not on page 2,3,4,etc.

    How can I achieve this?

    #1007100

    Leo Customer Support

    Hi there,

    If I understand this correctly, you can likely achieve this with a Hook Element:
    https://docs.generatepress.com/article/hooks-element-overview/

    With the filter to display it:
    https://docs.generatepress.com/article/generate_hook_element_display/

    And the conditional tag would be this one:
    https://codex.wordpress.org/Conditional_Tags#A_Paged_Page

    If you search keyword is_paged in our forum to see some examples.

    Let me know if this helps 🙂

    #1007111

    Sonja

    Hmm, okay, I understand, that i can use the generate_after_main_content hook. But how can I achieve, that this would be show only on first page of a specific category page?

    #1007145

    Leo Customer Support

    You can use the filter as I mentioned above.

    The code should be something like this:

    add_filter( 'generate_hook_element_display', function( $display ) {
        if ( 10 === $element_id && is_paged() ) {
           $display = false;
        }
    
        return $display;
    } );

    Make sure to replace 10 with the actual element ID.

    #1007148

    Sonja

    okay, that is too complicated for me. I don´t understand this. I think such thinks should be easier to do and not only available for coders.

    #1007200

    Leo Customer Support

    Have you tried the code above?

    The only part you need to change the element ID.

    Sometimes a little bit of code is required for specific display rules you are asking, which is why we are always available to help.

    #1007483

    Sonja

    I have create a after_main_content hook withthe display rules, that it shows only on this category archive.

    Then I have create the filter you postet and set the elemt ID of the hook.

    But the content (at the moment the word “test” shows also on page 2 of the archive.

    And also I want that the content should in a box like the other contetn on this site and have the same spacing like the other boxes.

    I have add the URL in the above post.

    #1007517

    David Customer Support

    Hi there,

    did you remove the hook and the filter? currently i cannot see the ‘test’ content on any of those pages. If you have, can you re-add them and let us know.

    #1007518

    Sonja

    Hi David,

    no it is still there on the URL i postet. You can see the word “test” below the pagination.

    #1007523

    David Customer Support

    Can you flush and disable your cache as i am not seeing the content.

    #1007527

    Sonja

    Okay, done.

    #1007534

    David Customer Support

    Now i can see it on page 1 only. So it seems to be working.
    I can still see the cache enabled which is making it tricky to style the element. Can you make sure all your cache plugins are disabled?

    #1007544

    Sonja

    I can see it on both pages. With different Browsers.

    I use WP-Rocket. Is it possible to deactivate the plugin and activate again without any problems? Or do i have to do soemthing special after activate ist again?

    #1007552

    David Customer Support

    You can flush/purge/clear ( or whatever they call it ) first then disable it, then when were done you can re-enable it.

    You may also need to flush your browser caches after disabling the plugin. Best to view the site in an Incognito/Private browser to test if its also a browser caching issue.

    #1007558

    Sonja

    OK I have deactivate it. But I see the test still on both pages.

Viewing 15 posts - 1 through 15 (of 39 total)

You must be logged in to reply to this topic.