Case study: How to show only the related tags and portfolio categories – Enfold theme

Ticket to the Enfold Support Team #1153473

by using tag cloud widget area

Avia Builder Element

Case

1. I would like to have an option in Tag Cloud Widget, where you could choose to display “all” or “related” tags and/or categories, when added to a single portfolio/blog.

2. How to show only the related tags/portfolio categories?

Test

I created two Enfold Child Custom Widget Areas: tags and portfolio categories. As you could see:

  • the widget area shows all the available tags(5) / categories(4)
  • and there are only 3 tags and 2 categories related to the page

Tags

Related Tags Cloud Front-End

Pic.1 Tags Cloud

Related Tags

Pic.2 Related tags

Portfolio Categories

Related Portfolio Categories Cloud Front-End

Pic.3 Portfolio Categories Cloud

Related Portfolio Categories

Pic.4 Related Portfolio Categories

by using short codes

Short codes are pasted to a Text Avia Builder Element

Request

3. How to show only the related tags/portfolio categories?
4. How to have the same design as the widget area?

Test

I added two shortcodes: portfolio_tags and portfolio_category. As you could see in tests 1, 2, 3.

In order to have related tags and portfolio categories, I researched for similar topics in the Enfold Support Forum.

Using Short Codes In Avia Builder

Pic.5 Using Short Codes

1. Tags & Portfolio Categories

I started by following the instructions in:
Enfold Support Ticket #673578

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 .= ''.$term->name.' ';
	}
    return $output;
}
add_shortcode('portfolio_category', 'show_portfolio_category_func');

Result

Only Related Portfolio Categories, Clickable

Pic.6 Test 1 – Related Portfolio Categories, Clickable

a) It shows only the related categories – OK
b) Clickable – OK
c) Design – NOK

*The snippet is currently commented (functions.php).

2. Portfolio categories

The first ticket (#673578) refers to another snippet:
Enfold Support Ticket #540059

function show_portfolio_category_func() {
	global $post;
	$the_terms = get_the_terms( $post->ID , 'portfolio_entries');
	ob_start();

	echo $the_terms[0]->name;

	$output = ob_get_clean();
    return $output;
}
add_shortcode('portfolio_category', 'show_portfolio_category_func');

Result

Primary Portfolio Category, Non-clickable

Pic.7 Test 2 – Primary Portfolio Category, Non-clickable

a) It shows only the Primary category – NOK
b) Non-clickable – NOK
c) Design – NOK

*The snippet is currently active (functions.php)

3. Tags

In order to have related tags, I followed the instructions here:
Enfold Support Ticket #813872

function show_portfolio_tags_func() {
	global $post;
	$the_tags = get_the_tags( $post->ID , 'portfolio_entries');
	$output = '';
	foreach($the_tags as $tag) {
		$taglink = get_tag_link($tag->tag_id);
		$output .= ''.$tag->name.' ';
	}
    return $output;
}
add_shortcode('portfolio_tags', 'show_portfolio_tags_func');

Result

Only Related Portfolio Categories, Clickable

Pic.8 Test 3 – Related Portfolio Categories, Clickable

a) It shows only the related tags – OK
b) Clickable – OK
d) Design – NOK

*The snippet is currently commented (functions.php).

Summary

Case study: How to show only the related tags and portfolio categories – Enfold theme

The initial need came from portfolio posts. The only option I found was using a custom widget area. Then my online research led me to the 3 solutions that work partially.

Test 1 and 3 (see above) have the needed functionality, BUT not a good design. Elements have to be separated.

Enfold Support Answer:
The Tag Cloud widget is not from the theme. It is a default WP widget, so the changes that you’re after will require modifications that are beyond the scope of support. The easiest solution is to find a plugin that will satisfy these requirements. Or hire someone else to add the feature or modification for you.

See more in my Enfold Support Ticket #1153473

1 reply
  1. Aleksandra Mandalova
    Aleksandra Mandalova says:

    Hey, there!
    This is my first case study article. Give it a boost by sharing it.
    10x

Comments are closed.