Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1152788

    Hi,
    I found the following function to display portfolio categories on a portfolio item:
    function show_portfolio_category_func() {
    global $post;
    $the_terms = get_the_terms( $post->ID , ‘portfolio_entries’);
    $output = ”;
    foreach($the_terms as $term) {
    $termlink = get_term_link($term->term_id, $term->taxonomy);
    $output .= ‘<span class=”portfolio_cat”>‘.$term->name.’ </span>’;
    }
    return $output;
    }
    add_shortcode(‘portfolio_category’, ‘show_portfolio_category_func’);

    How do I modify this to ONLY show categories within the Parent Category “Habitats”?

    If you look in private content and scroll to the bottom, you can see the portfolio categories listed – I like this but want to remove the categories that are not part of the Habitats parent category.

    Thanks for your help as always!

    #1154425

    Hey connect4consulting,

    Can you please explain a little bit for us:

    1. Are you trying to show everywhere only the Parent Category Habitas ( if yes – we need to category ID )
    2. Do you want everywhere to so the Parent category of the active is visible?

    Reply this and we can help you modify the function, it should be an If statment.

    Best regards,
    Basilis

    #1154427

    Hi Basilis,
    Thanks!

    I’d like to know both answers.

    In this scenario, I want to only show the parent category for “habitats” but I have another scenario where I only want to show the parent category “features”. In both situations, it’s a parent category, however.

    I want to be able to use a shortcode and display the types of habitats of each portfolio item and then another shortcode to display all of the features of each portfolio item – in two different spots on the page.

    The category ID for habitats is 218.
    The category ID for features is 248.

    Thanks so much!
    Gabe

    #1155096

    Basilis,
    I’d love to know your answer to my questions!
    Love the theme and support team!
    Thanks so much!!!!

    #1155532

    Hey!

    Sorry for the late response. We replied in the other thread.

    // https://kriesi.at/support/topic/how-do-i-show-portfolio-categories-on-a-portfolio-item/#post-1155473

    Please continue in that thread and refrain from creating duplicates to avoid confusion. Thank you for your patience.

    Cheers!
    Ismael

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘How do I display portfolio categories on an individual portfolio item?’ is closed to new replies.