Change attribute sort order in Listing Secondary

Hello, In ExpertHive, Im wondering if it is possible with a snippet to change the sort order of attributes within the Listing Secondary only

For example
the sort order for the following attributes is

  • yearsinbusiness order = 70
  • financingavailable order = 60
  • bbbrating order = 90

However, in the Listing Secondary section, I would like to revie the sort order to

  • yearsinbusiness order = 10
  • financingavailable order = 20
  • bbbrating order = 30

It looks like this snippet might have something to do with it but im unable to figure out how to add my attributes

add_filter(
	'hivepress/v1/templates/listing_view_page',
	function( $template ) {
		return hivepress()->helper->merge_trees(
			$template,
			[
				'blocks' => [
					'listing_attributes_secondary' => [
						'_order' => 123,
					],
				],
			]
		);
	},
	1000
);

any advice and suggestions are much appreciated.

Hi,

You can try this code snippet:

add_filter('hivepress/v1/forms/listing_update', function ($form) {
 $form['fields']['field_name_here']['_order'] = 123;

    return $form;
}, 1000);

It works vice versa, you can use the Order field for sorting attributes for display, and use the code snippet to change the form fields order.

Hope this helps

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