Hello. This a following from a issue I raised a while ago, which you can see here:
https://toolset.com/forums/topic/output-different-templates-with-one-taxonomy/
In summary, the goal is to output slight different information according to the taxonomy applied (parent, child, etc).
It was solved, but now I am migrating the site to the Genesis framework and it no longer works.
The code that was working until now in functions.php was the following:
/**
* Code for adding a custom archive page for different sections.
*/
add_filter( 'wpv_filter_force_wordpress_archive', 'switch_tax_archive_by_level', 30, 2 );
function switch_tax_archive_by_level( $wpa_assigned, $wpa_loop ) {
$wpa_to_apply = $wpa_assigned;
$tax = get_queried_object() ? get_queried_object()->taxonomy : null;
if ($tax == 'viagens') {
$current_term_level = get_tax_level(get_queried_object()->term_id, get_queried_object()->taxonomy);
if ($current_term_level == 1) {
// show top-level archive
$wpa_to_apply = 1761;
} else if ($current_term_level == 2) {
// show mid-level archive
$wpa_to_apply = 1722;
} else {
// show third-level archive
$wpa_to_apply = 4129;
}
} elseif ( is_home() ) {
$wpa_to_apply = 1771;
}
return $wpa_to_apply;
}
Nothing has changed in terms of structure, either in Toolset or the website, so all taxonomy relations still apply.
Any help to fix it would be great.
Thank you in advance.
Hello,
How do you migrate you website to Genesis framework?
How do you setup the taxonomy "viagens" archive page? You need make sure it is using Toolset WordPress Archive to render the archive page, see our document:
https://toolset.com/course-lesson/creating-a-custom-archive-page/
Since it is a custom PHP codes + compatibility problem, please provide a full copy of your website in below private message box, , you can put the package files in your own google drive disk, share the link only, also point out the problem page URL and WordPress Archive URL, I need to test and debug it in my localhost, thanks
https://toolset.com/faq/provide-supporters-copy-site/
Hi there.
Thanks for the reply. I've managed to find a solution using views/templates and conditionals, so I won't need the custom code.
Thanks.