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)?
yevhen
October 17, 2022, 10:19am
3
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.
yevhen
November 7, 2022, 3:18pm
6
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.
system
Closed
December 9, 2022, 7:47am
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.