Site logo

Archived topic

Change the style for the Previous/Next section

26 replies · Started by Elia on May 15, 2019

Viewing posts 16–27 of 27

Hi David,

I found the issue. The code that you provide conflict with this code for some reason:
https://gyazo.com/c76f69adfcc7cf7f72d6a79266753d83

We use this code to exclude one of the categories from the main blog page

Any ideas on how to fix this?

Thanks

Hi David, this is just a reminder about our problem.

Thanks a lot!

Hi there,

apologies - this somehow got overlooked - i am going to reference the issue with the other topic Tom is looking at - as it seems the issues are related.

Hi David,

I'm not sure that they are related. I tried just the Tom's code without other codes and it didn't work, but anyway, please keep me updated

So does the code David provided on page 1 work without that pre_get_posts function? They shouldn't conflict, as David's code should only apply on single posts, and the function only applies on the blog page.

Hi Tom, yes exactly. If I disable pre_get_posts then it's working

Hmm, that function is set to is_home, so it shouldn't apply on single posts. Just to confirm, the Hook David gave you is set to single posts, right? Not the blog/posts page?

Yes, Tom, thanks

It shouldn't actually do anything at all on single posts according to the code.

Can you link me to the blog page (where the category is excluded) and a single post (where David's code should work)?

That's strange I agree.

Please take a look at the link in my first post. It leads to all my blog posts. The custom navigation should appear on every post. But it's available (partially) only in some blog posts.

I also checked the same code on my staging website. The same problem happening. When the code to exclude category from the blog page is enabled then David's code doesn't work properly

Can you test the same code on your website?

Try this as your function instead:

add_filter( 'pre_get_posts', function( $query ) {
	if ( is_home() ) {
		$query->set( 'cat', '-40' );
	}

	return $query;
} );

Please delete this message. I sent it accidentally

This archived topic is closed to new replies.