4 columns to more than one category

I’m using this code to transform a listing category page with id 1447 to 4 column

add_filter(
	'hivepress/v1/templates/listings_view_page',
	function( $template ) {
		if(is_tax('hp_listing_category') && 1447 === get_queried_object_id()){
			$template = hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listings' => [
						'columns' => 4,
					],
				],
			]
		);
		}
		return $template;
	},
	1000
);

how to apply this code to more than one id like (1447, 1448,1449)?

Please try this PHP snippet instead. Please just change 1,2,3 on the categories id where you want to set four columns per row for listings

add_filter(
	'hivepress/v1/templates/listings_view_page',
	function( $template ) {
		if(is_tax('hp_listing_category') && in_array(get_queried_object_id(), [1,2,3])){
			$template = hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listings' => [
						'columns' => 4,
					],
				],
			]
		);
		}
		return $template;
	},
	1000
);

hi i tried with experthive theme for all the categories but it didn´t work!

add_filter(
'hivepress/v1/templates/listing_categories_view_page',
function( $template ) {
return hivepress()->helper->merge_trees(
$template,
[
'blocks' => [
'listing_categories' => [
'columns' => 4, // Just change columns number by your requirements.
],
],
]
);
},
1000
);

i see 1 column of services. All is good with these theme? thanks in advance.

It was tested locally and seems to be ok. Please use the Code Snippets plugin to add and manage custom PHP code snippets Code Snippets – WordPress plugin | WordPress.org

If the issue persists then please send more details that may help to detect or reproduce this issue (e.g. a link to your site, screenshots, or the error message you get).

hi, i sent you and email to support@hivepress.io reproducing the issue with experthive. Thanks.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.