-
AuthorPosts
-
May 22, 2020 at 2:50 pm #1215248
Hi I created, in addition to the standard “categories” taxonomy, a couple of additional custom taxonomies (named “types” and “locations”). On the blog page, where I show all posts, I need to show only the standard “Categories” taxonomy (hence not the custom taxonomies). I set the blog page as elegant theme (cats over the title) with a grid layout.
Where I can change it? I don’t want all the terms, but just the category (I guess that I should use get_the category() )
ThanksMay 24, 2020 at 5:31 pm #1215819Hey Elena,
You can use the options to build the blog page with the Advanced Layout Builder, add the blog posts element there and choose the category that you want to display there.
If you need further assistance please let us know.
Best regards,
VictoriaMay 25, 2020 at 8:48 am #1216022Sorry I realize now that my question was misleading. No problem in showing the list of post based on the selected taxonomy (in this case all categories). What I need to do is to set to display:none the custom taxonomies and just keep the categories visible. See image example (https://drive.google.com/file/d/1dYed9TNbvjM_GA20O9Cp26W9k5DXEsC1/view?usp=sharing)
I need hence to understand which function I can add to my functions.php to accomplish it, when on page xxx.
ThanksMay 25, 2020 at 5:50 pm #1216200Hi elenapoliti,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaMay 26, 2020 at 11:46 am #1216453Thanks I am going to add the link in the private page.
May 26, 2020 at 7:02 pm #1216596Hi elenapoliti,
Best regards,
VictoriaMay 26, 2020 at 7:08 pm #1216599Hi Victoria thanks for clearing that: I knew that it was impossible to manage the issue via css. I come so to my first question: where should I add my conditional php? Consider that the page is built with ALB and it show a blog post grid. I can add some condition such as get_taxonomies or get_terms and filter them, but I would like to know where I can add my code. In the functions.php with some hook or in a template?
Thanks for clarifyingMay 26, 2020 at 8:18 pm #1216660Hi elenapoliti,
It is done in many files, I guess you’ll need to do a search in your editor for get_terms and investigate all instances.
Best regards,
VictoriaMay 26, 2020 at 11:21 pm #1216713Excuse me Victoria but you don’t answer my question. I did the search and the only file that must be responsible for the output is the avia-shortcodes/blog/blog.php
The output in blog grid is as follows<span class="blog-categories minor-meta"> <a href="http://localhost:8888/adrianovenudo/category/tipo-2/" rel="tag">Tipo 2</a> <a href="http://localhost:8888/adrianovenudo/luoghi/trentino/" rel="tag">Trentino</a> <a href="http://localhost:8888/adrianovenudo/tipologie/progetto/" rel="tag">Progetto</a> </span>
The first is a Category, the second and third are taxonomies. So please can you help me in changing the blog.php code so that the output maybe somethings like
<span class="blog-categories minor-meta"> <a href="http://localhost:8888/adrianovenudo/category/tipo-2/" rel="tag">Tipo 2</a> </span> <span class="blog-taxonomies minor-meta"> <a href="http://localhost:8888/adrianovenudo/luoghi/trentino/" rel="tag">Trentino</a> <a href="http://localhost:8888/adrianovenudo/tipologie/progetto/" rel="tag">Progetto</a> </span>
Thank you
May 26, 2020 at 11:46 pm #1216719As an update, I actually found that I should work on the loop-index.php that seems to be responsible of the minor-meta .
I changed line 291 from
$cats .= get_the_term_list( $the_id, $taxonomy, '', ', ', '' ) . ' ';
to
$tax .= get_the_term_list( $the_id, $taxonomy, '', ', ', '' ) . ' ';
and added just after line 308 and before line 309 the following
$cat_output .= '<span class="blog-taxonomy minor-meta">'; $cat_output .= $tax; $cat_output .='</span>';
Still no success. Any suggestion?
- This reply was modified 4 years, 7 months ago by elenapoliti.
May 27, 2020 at 1:20 am #1216753I got it. File postslider.php in shortcodes. Changed the lines 765-789 in the following code
if( $show_meta ) { $taxonomies = get_object_taxonomies( get_post_type( $the_id ) ); $cats = ''; $categories = get_the_category($the_id); //$excluded_taxonomies = array_merge( get_taxonomies( array( 'public' => false ) ), array( 'post_tag', 'post_format' ) ); //$excluded_taxonomies = apply_filters( 'avf_exclude_taxonomies', $excluded_taxonomies, get_post_type( $the_id ), $the_id ); if( ! empty( $categories ) ) { foreach( $categories as $category ) { $cats .= '<a href="'.get_category_link($category->cat_ID).'">'. $category->name . '</a>'; } } if( ! empty( $cats ) ) { $meta_out .= '<span class="blog-categories minor-meta">'; $meta_out .= $cats; $meta_out .= '</span>'; } }
You can close the ticket
- This reply was modified 4 years, 7 months ago by elenapoliti.
May 27, 2020 at 2:20 pm #1216950Hi elenapoliti,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
VictoriaAugust 22, 2020 at 5:45 pm #1239977Hello Victoria,
I have this exact requst https://kriesi.at/support/topic/get-one-specific-custom-category-to-display-in-blog-archive/#post-1215819 , I’d like to display the articles in a certain category on the blog archive page OR display these specific articles on a page the same way the blog archive displays them.
I have added the blog posts element in the blog archives page identified on the ChildTheme backoffice. Then I chose the category that I wanted to display there, bu it still shows all cats posts.
Would be wonderful if you could help me,
Have a nice day,
CamilleAugust 27, 2020 at 5:11 pm #1241271 -
AuthorPosts
- The topic ‘Get one specific custom category to display in blog archive’ is closed to new replies.