Adding Portfolio Category section to Single Porfolio Item page sidebar

Hi Team

Currently in a single Portfolio Item page, in the sidebar (where you have the option to “Launch Project” etc) there is only the Portfolio Item Tags showing. Is there any way to be able to short the Portfolio Item Categories here as a separate entry within the sidebar as well - complete with a header as well (like Tag section has)?

I’m aware the Category shows in the Meta info of the Portfolio Item, but I’m looking to show this info in the Sidebar and then have the Meta info hidden.

Screenshot of tags showing, but not Category:

Thanks
Sam

Hi Sam,

Thanks for reaching out.

Are you referring to Integrity portfolio single page? If yes then please add this to your child theme’s functions.php

  function x_integrity_portfolio_tags() {

    $terms = get_the_terms( get_the_ID(), 'portfolio-tag' );

    echo '<ul class="x-ul-icons">';
    foreach( $terms as $term ) {
      echo '<li class="x-li-icon"><a href="' . get_term_link( $term->slug, 'portfolio-tag' ) . '"><i class="x-icon-check" data-x-icon-s="&#xf00c;"></i>' . $term->name . '</a></li>';
    };
    echo '</ul>';


   echo '<h2 class="h-extra skills">' . __('Categories', '__x__') . '</h2>';

    $terms = get_the_terms( get_the_ID(), 'portfolio-category' );

    echo '<ul class="x-ul-icons">';
    foreach( $terms as $term ) {
      echo '<li class="x-li-icon"><a href="' . get_term_link( $term->slug, 'portfolio-category' ) . '"><i class="x-icon-check" data-x-icon-s="&#xf00c;"></i>' . $term->name . '</a></li>';
    };
    echo '</ul>';


  }

It should override the existing tag function and includes the category.

Hope this helps :slight_smile:

Thanks!

Thanks Rad! Apologies, I’m using the Renew stack (with some minor alterations).

I adjusted the above code slightly to replace ‘integrity’ with ‘renew’ in the first line and it has worked really well, except it’s replaced the ‘x-icon-chevron-right’ icon with the tick icon. Do you know the icon code for chevron right? I note in the above code, it looks to be using “” currently?

Also - would I be able to manually update the “Categories” title somewhere as well?

Sorry, not too savvy with raw coding.

Updated appearance:

Cheers,
Sam

Hello Sam,

Thanks for updating in!

To change the check icon to chevron, please find this code:

<i class="x-icon-check" data-x-icon-s="&#xf00c;"></i>

and replace it with this:

<i class="x-icon-chevron-right" data-x-icon-s="&#xf054;"></i>

The “Categories” title were hard code in the function:

echo '<h2 class="h-extra skills">' . __('Categories', '__x__') . '</h2>';

You will have to manually edit in the code if you want to replace it.

Best Regards.

1 Like

Thanks RueNel that worked re updating the icons.

Regarding the ‘Categories’ title can you please assist in providing additional steps on how to do this? Am I able to adjust in the Child Theme via different code so as not to have to re-do every time there’s a Theme update?

Thanks
Sam

Hi Sam,

The code that was provided to you by my colleague, needs to be added in your child theme’s funcitons.php file.
So no need to worry about theme update.

In that code there is this line

echo '<h2 class="h-extra skills">' . __('Categories', '__x__') . '</h2>';

You may change Categories to any text you like.

Thanks

1 Like

Ah yep, I see! Thanks Paul

You’re welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.