Tagged: ,

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #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() )
    Thanks

    #1215819

    Hey 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,
    Victoria

    #1216022

    Sorry 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.
    Thanks

    #1216200

    Hi elenapoliti,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

    #1216453

    Thanks I am going to add the link in the private page.

    #1216596

    Hi elenapoliti,

    Best regards,
    Victoria

    #1216599

    Hi 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 clarifying

    #1216660

    Hi 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,
    Victoria

    #1216713

    Excuse 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

    #1216719

    As 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, 6 months ago by elenapoliti.
    #1216753

    I 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, 6 months ago by elenapoliti.
    #1216950

    Hi elenapoliti,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

    #1239977

    Hello 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,
    Camille

    #1241271

    Hi,


    @Missca
    : Where can we see the issue? Please open a new thread and provide the necessary details in the private field so that we can check it properly. We’ll close this thread for now.

    Best regards,
    Ismael

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Get one specific custom category to display in blog archive’ is closed to new replies.