Site logo

Archived topic

Content below Posts on category page

44 replies · Started by Marius on September 11, 2019

Viewing posts 1–15 of 45

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?

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?

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.

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.

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.

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.

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.

Hi David,

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

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

Okay, done.

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?

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?

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.

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

This archived topic is closed to new replies.