This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Different vertical results template based on groups

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Different vertical results template based on groups Reply To: Different vertical results template based on groups

#54934
Ernest MarcinkoErnest Marcinko
Keymaster

Hi,

In theory yes, but definitely needs some custom work.

If it’s only CSS classes and nothing major, then I recommend using the group-header.php template file, where you can do some conditional checks via the $group_class, $group_url and $group_name variables.

If something more complex, then within the vertical.php you also have access to those variables, they are passed on, so you can do conditional checks against the $group_class, $group_url and $group_name variables too.

Based on that you could create more files like vertical1.php, vertical2.php etc.. and do logics like:

if ( $group_name === 'Group name 1' ) {
	require_once 'vertical1.php';
} else if ( $group_name === 'Group name 2' ) {
	require_once 'vertical2.php';
} else {
	require_once 'vertical_default.php';
}

..altough I’m not sure if the variables will be passed on to the required files.

Alternatively you can do the whole logic in the vertical.php file directly too:

<?php if ( $group_name === 'Group name 1' ): ?>
	<div>...</div>
<?php elseif ( $group_name === 'Group name 2' ): ?>
	<div>...</div>
<?php else: ?>
	<div>...</div>
<?php endif; ?>