I am trying to: I am trying to apply 2 different template archive to differents categories
Link to a page where the issue can be seen: This are the categories and subcatgories I like to apply this archive templete hidden link the categories are:
LEGISLATION; hidden link
BIBLIOGRAPHY: hidden link
FACTSHEETS: hidden link
PROTOCOLS: hidden link
The problem if I go to the archive temeplete hidden link and on on "Taxonomy Archives" I select the Categories I like to apply the archive templete it works but now I go to the other archive tamplete in which previously in "Taxonomy Archives" I already select the categories now are not selected
Hello, it is not currently possible to select different archives for terms in the same taxonomy from wp-admin. We have an API available that will force specific WordPress Archives for specific terms. I want to be sure I understand which templates you want to apply, then I can give you some example code. For these 4 archives, you want to apply archive #17411:
LEGISLATION; hidden link
BIBLIOGRAPHY: hidden link
FACTSHEETS: hidden link
PROTOCOLS: hidden link
For all other category archives, you want to apply archive #17778. Is this correct?
Yes that is right for those 4 categories apply archive #17778 and for the the rest of categories the archive 17778 but this is done already.
Thanks Christian
Okay try this custom code. You can add it to a child theme's functions.php file, or you can create a new code snippet in Toolset > Settings > Custom Code:
add_filter( 'wpv_filter_force_wordpress_archive', 'switch_category_archive_per_term', 30, 2 );
function switch_category_archive_per_term( $wpa_assigned, $wpa_loop ) {
$wpa_to_apply = $wpa_assigned;
// IDs of all terms that should have the 17411 archive applied
$special_terms = array( 116, 117, 118, 120 );
$current_taxonomy = isset(get_queried_object()->taxonomy) ? get_queried_object()->taxonomy : null;
// only for category taxonomy
if( !$current_taxonomy || $current_taxonomy != 'category' )
return $wpa_to_apply;
$current_term = get_queried_object()->term_id;
if( in_array( $current_term, $special_terms ) ) {
$wpa_to_apply = 17411;
}
return $wpa_to_apply;
}
If you ever want to apply the 17411 archive to another term, find that term's numeric ID and add it to the $special_terms array in a comma-separated list. You can find the term ID in the URL if you edit the term, like here:
hidden link
tag_ID = 116 for legislation.
Hi I add it to " Toolset > Settings > Custom Code:" I attach screenshot "snipp.jpg" but as you can see any of the archive categories are loading the templete and also it say no items founds. By the way I add category 119 I forgot that one.
hidden link
hidden link
hidden link
hidden link
hidden link
Also is funy because when I search I get results from all categories except these 5, I have install "Relevanssi Search" and Index all, but no results
Forget about seach results, is ok now, but the snip seems to be not working on the archive categories:
hidden link
hidden link
hidden link
hidden link
hidden link
It seems the WordPress Archive is being applied to these archive URLs, because if I add some text in the "No results found" message you can see it appear in the page. (see the screenshots) The problem has to do with the query, and I think it is because archive 17411 is also the Home/Blog archive. The only posts assigned to this archive are Legislation posts, but the category terms are applied to Good Practices posts.
So you could add Good Practices to the Home/Blog archive (but that could affect the Home/Blog content), or you could create a separate archive specifically for the Category taxonomy (not Home/Blog), where you can specify you want to include the Good Practices post type, not the other post types.
That's my best guess at this point, and I didn't want to go making changes on your site without explaining the options. Let me know if this doesn't solve the problem.
Hi I add "GOOD PRACTICES ARCHIVE FINAL" (17778) to the Home/Blog archive (see the screenshots), I even try un check "Home/Blog archive" and add all post types to home/blog archive to "GOOD PRACTICES ARCHIVE FINAL" (17778), but nothing legislation and the other subcategories still apply good "GOOD PRACTICES ARCHIVE FINAL" (17778)
Make changes, no problem, also you may know why on this categories the archive page we are toalking aboyt and the search results is no showing the footer, the same in good practices archive hidden link
Many many thanks
I'm no longer able to log in using the credentials you provided earlier. Can you check and provide new credentials if necessary? If I'm not logged in, I see a Service Unavailable error here: https://www.prehlb.eu/category/good-practices/
Check here and see all the Good Practices posts:
hidden link
There are only 3 posts, and none of them use the term "Bibliography", or "Protocols". That's why the archives for these terms are empty. Maybe I'm misunderstanding the problem. Which posts do you expect to see here?
What I like is when you enter to archive of this 5 categories:
hidden link
hidden link
hidden link
hidden link
hidden link
To see the list of post of this categories with the design of archive templete "LEGISLATIONS-ARCHIVE" (17411), so enter to any of those 5 links shoul look similar to hidden link
Okay thanks, I see the problem. In the WP Archive 17778 you must also activate the Legislation post type in the taxonomy archive settings. I made that change and now I can see posts in the bibliography archive. Can you check now?
I love you!!! finally you great, maybe you know why in al archive page and search results the footer is not showing, last time I use theme the7 with tool set.
By the way I remember that before the agency license was for life, a year ago that is no longer like that, what worries me is that if I use a tool set on a web page registering the plugin after a year I will not be able to update it and I'm afraid that With time after update to new versions of wordpress tool set stop working properly.
Thank you
maybe you know why in al archive page and search results the footer is not showing
I'm not sure offhand, but in older versions of The7 theme the footer was not shown in archives pages by design:
https://theeventscalendar.com/support/forums/topic/widget-containing-footer-upper-part-not-showing-in-events-pages/
It may simply be the case that the theme is not set up to display the widgetized footer in the archives. You should be able to tell by temporarily disabling Toolset plugins and checking one of the archive pages.
what worries me is that if I use a tool set on a web page registering the plugin after a year I will not be able to update it and I'm afraid that With time after update to new versions of wordpress tool set stop working properly.
If you don't plan to update Toolset plugins in the future, I would not recommend updating WordPress and other plugins either. If you want to get the latest features of WordPress and Toolset, it will be necessary to purchase a new license after yours runs out. We've written about the decision and tried to inform everyone through our blog: https://toolset.com/2018/04/why-were-not-going-to-offer-any-more-lifetime-accounts-for-toolset/
Sorry for the inconvenience, but our plan is to no longer allow new Lifetime subscriptions.