Support » Plugin: Tag Groups » PHP example from Front End page does not work

  • Resolved elarpa

    (@elarpa)


    I have copied the link exactly as is on the Front End page of the plugin into my sidebar.php file:

    <?php if ( function_exists( ‘tag_groups_cloud’ ) ) echo tag_groups_cloud( array( ‘include’ => ‘1,2,5,6’ ) ) ?>

    The result is that the tag groups display as taps, but no tags are displayed underneath.

    Please advise what I am doing wrong since none of the tags are displaying.
    Thank you in advance.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Chris

    (@camthor)

    1. What do you see if you use [tag_groups_cloud include=1,2,5,6] in a post and then click preview?

    2. Please post a link to the page where I can see the result.

    3. Are you sure that you have tag groups with the IDs 1,2,5 and 6 and that these groups contain tags, which were used with published posts?

    4. Please also check the settings and make sure that “Collapsible tabs” is off (under “Front End” -> “Themes and Appearance”)

    • This reply was modified 2 months, 4 weeks ago by Chris.

    Hi Chris,

    Thanks for responding so quickly.

    1. With a shortcode I see the same. You can see it here:

    2. https://autentical.com/test/

    3. I have 3 tag groups – I also tried including 1,2,3 – and the tag groups come up correctly. But still without any tags below…

    BUT: I now found out that it is a language issue… (I use WPML). When publishing on the German site the tags come up.

    So the challenge is now: How do I ONLY display German tag groups on the German site and English tag groups on the English site – when the sidebar.php is commom for all languages?

    Thanks again for your help.

    Plugin Author Chris

    (@camthor)

    It should be possible to choose different group names for each language (in the admin you can set the language in the top bar). Then you assign the translated tags to the translated tag groups. It is possible, that the translated tags were not used in published posts (only the untranslated tags). You can add the parameter hide_empty=0 to show all tags, or with PHP
    if ( function_exists( 'tag_groups_cloud' ) ) echo tag_groups_cloud( array( 'include' => '1,2,5,6', 'hide_empty' => 0 ) );

    PS: You could also try with remove_filters=0 if that didn’t help.

    Hi Chris,

    1) “…translated tag group…” you say. But I cannot see anywhere tag groups can be translated… And if I create extra tag groups they will all appear on all languages. Please explain how to translate tag groups.

    2) My real desire is to show only the relevant tags for each destination (‘category’). I managed to set it up on …/category/… pages (as you may see on e.g. https://autentical.com/category/portugal/), but not on …/tag/… pages. I have noticed that you have undocumented functionality for the categories in the plugin… Is there any way to use this plugin to show only tags relevant to the category – even when clicking the tag and ending up on the …/tag/… page?

    Thank you in advance for your help.

    Plugin Author Chris

    (@camthor)

    1) You click into the name of a tag group and then write the name in the selected language. see https://documentation.chattymango.com/documentation/tag-groups-premium/getting-started/translating-tag-group-names-with-wpml-2/

    2) It’s not possible out of the box, but you could embed some custom code into your theme so that the “include” parameter that you already used is different, depending on the category. It’s more or less this code: https://documentation.chattymango.com/documentation/tag-groups/for-developers-tag-groups/examples-of-applications/#2–display-a-different-tag-cloud-on-each-category-page-

    3) (anticipating your next question 😀 ) I am now investigating a possible bug that shows tags of the wrong language. If that happens, please wait for the next update.

    1) I got the tag groups translated. Thanks.

    2) I have tested your application example no. 2 and it also only works on …/category/… pages – not on …/tag/… pages.

    Plugin Author Chris

    (@camthor)

    Which code did you use on the tags pages? get_cat_ID surely won’t work here, that’s only for categories.

    Maybe this could work (in the tag archive template):

    
    $tag = get_queried_object();
    
    $term_group = array(
    		'term-1' => 3,
    		'term-2' => 2,
    	); // ... left side tag slugs, right side group IDs
    
    if ( function_exists( 'tag_groups_cloud' ) && isset( $term_group[ $tag->slug ] ) ) {
      echo tag_groups_cloud( array('include' => $term_group[ $tag->slug ] ) );
    }
    

    Thanks a lot. I will try this.

    But if it works I will want to display the tags in my theme’s style (the theme link style). Isn’t that possible with the plugin?

    Yes, it works. Thank you.

    Now just the question about how I can use the link design of the theme?

    I tried already ” Don’t load a theme.” and “Allow HTML in tag description”, but this does not bring back the theme link design….

    Please let me know how I can get the default theme link design for the tags. Thank you in advance.

    PS! I don’t need the Tag Group name – just the tags of the tag group.

    Plugin Author Chris

    (@camthor)

    For design customization questions you need to consult your web designer. The plugin provides only a basic design.

    OK, fair enough.

    Just one question: Why does ”Don’t load a theme.” not cancel the design build into the plugin so that the standard link design of the theme would work?

    Plugin Author Chris

    (@camthor)

    These things work differently. Your theme uses CSS to define the properties of all items that the theme creator decided to integrate. The theme cannot automatically design all items that are additionally added later. In general, nothing in web design works automatically, there is a lot of invisible work behind the scenes. So someone must apply your theme’s design to everything else that the theme creator was not aware about. This should be quite fast, if you know what to look for.

    The ”Don’t load a theme.” option disables jQuery UI themes, which you can see here: https://jqueryui.com/themeroller/ As you can see there that theme doesn’t affect the tags so that designers are free to use their own design.

Viewing 12 replies - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.