Show featured listings on the first page only

I was reading the following thread:

ihor i believe you didn’t understand his question, what he meant is that the highlight should only be on page 1, and not be repeated on the next pages, google works like this. Is there any code to make this change?

Please try this PHP snippet

add_filter(
	'hivepress/v1/templates/listings_view_page/blocks',
	function($blocks, $template){
		$page_number = hivepress()->request->get_context('page_number');
		
		if(!$page_number || $page_number <= 1){
			return $blocks;
		}
		
		$featured_ids = hivepress()->request->get_context('featured_ids');
		
		if(!$featured_ids){
			return $blocks;
		}
		
		hivepress()->request->set_context('featured_ids', []);
		
		return $blocks;
	},
	1000,
	2
);

Yevhen nothing changed after implementing the code. I expected all the featured listings to appear on page 1

Unfortunately, there is no simple solution, it requires code customizations, if you’re familiar with customizations please try using the pre_get_posts WordPress action pre_get_posts | Hook | WordPress Developer Resources. If you are not familiar with the code customization then please consider hiring someone for custom work https://fvrr.co/32e7LvY

This is a problem, especially for sites with plenty of featured listings. It gives no incentive for users to list OR buy non-featured services. I hope in the future this will be offered as an option without the need to pay extra for freelance work on premium template like experthive.

POSSIBLE SOLUTION:
Change the number of displayed services/listings per page so they all appear on one page. For example if you expect to have 87 listings, change the display number to 100. That way when user scrolls it has a chance to hit non-featured listings/services.

Yes, you can also try to reduce the number of slots, e.g. if you set 2 slots for featured listings and there are more than 2 featured listings then there’s a higher chance they’ll be different on each page, featured listings have random order.

1 Like