Tagged: custom taxonomy, description
-
AuthorPosts
-
March 15, 2018 at 5:13 pm #927492
Dear Enfold team,
I set up a literature list on my blog using a custom post type that has a custom taxonomy. I hid the features images and post meta via CSS – this is what a category page looks like now:
https://datenschmutz.net/litcat/twitter/
Is it possible to insert the title and description of the category on top of the category listing? (But not for all categories in general, only for this one custom taxonomy). The description gets displayed, but not the category title.
I searched the support forum, but I only found threads about woocommerce categories.
Thanks for your help,
greetings, Ritchie- This topic was modified 6 years, 8 months ago by datadirt.
March 16, 2018 at 6:57 am #927957Hey datadirt,
Thank you for using Enfold.
Please use this filter in the functions.php file.
add_filter('avf_which_archive_output','avf_which_archive_output_mod_litcat'); function avf_which_archive_output_mod_litcat(){ if (is_tax('litcat')) { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $output = __('Archive for:','avia_framework')." ".$term->name; } return $output; }
Best regards,
IsmaelMarch 16, 2018 at 2:27 pm #928112Hi Ismael,
thanks a lot! I added the filter to my functions php, but the titles do not show up – do I have to change something in the archive.php file as well?
greetings,
RitchieMarch 18, 2018 at 5:10 pm #928739PS @Ismael – is there a way to sort the output of the litcat custom taxonomy alphabetically by title?
March 19, 2018 at 6:52 am #928878Hi,
Please replace the filter with this code.
add_filter('avf_which_archive_output','avf_which_archive_output_mod_litcat'); function avf_which_archive_output_mod_litcat(){ if(is_tax()) { $output = __('Archive for:','avia_framework')." ".single_term_title( '', false ); } return $output; }
For the post order, try to use the pre_get_posts function.
// https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
Best regards,
IsmaelOctober 24, 2018 at 2:32 pm #1025907Hi @Ismael,
sorry for going back to this, but I can’t figure it out – been through all the threads, but I just can’t figure out how to display the titles.
The above snippet doesn’t seem to be working… any ideas?greetings, Ritchie
October 25, 2018 at 12:38 pm #1026324Hi,
It’s been a while. I hope you’re doing good.
Regarding the issue, you have to enable the theme’s Header Title and Breadcrumbs from the Enfold > Header panel.
The code above filters the output of that function or settings.Best regards,
IsmaelOctober 25, 2018 at 2:21 pm #1026357Hi Ismael,
thanks for asking – yes, I’m quite fine. And totally amazed by the 4.4 / 4.5 updates.
I activated the titles – works fine, only problem is though that I only want to use these titles for my cat/archive/tax pages. (as all the exisiting pages / blogpostings do have “manual” titles). Is there any way to activate the titles/breadcrumbs but then NOT to display them on postings/pages?
greetings,
RitchieOctober 26, 2018 at 10:25 am #1026685Hi,
Yes, that’s possible. Use this filter:
add_filter('avf_header_setting_filter', 'avf_header_setting_filter_mod', 50, 1); function avf_header_setting_filter_mod($header_settings) { if ( is_tax() || is_archive() ) { $header_settings['header_title_bar'] = "title_bar_breadcrumb"; } return $header_settings; }
Disable the title and breadcrumbs from the theme options.
Best regards,
IsmaelOctober 26, 2018 at 11:45 am #1026726Hi Ismael,
thank you so much – this is absolutely brilliant!!
have a great weekend,
RitchieOctober 26, 2018 at 3:14 pm #1026835 -
AuthorPosts
- The topic ‘Category Title & Description on custom taxonomy category pages’ is closed to new replies.