• Resolved ttc2003

    (@ttc2003)


    Hi. Maybe anyone can help me out on this.

    I am building a car dealer website and within it i have embedded TAG groups with the following groups (all examples):
    A. Interior
    B. Exterior
    C. Security
    D. Infotainment
    C. Other
    Then i linked features to the right TAG group.
    1. aloy wheels (B)
    2. Airco (A)
    3. Park Distance Control (C)
    4. S-line exterior (B)

    etc. etc.
    When i add a new car i add the features for this car.For example 1 and 4, so i get a Tag group tabbed display.

    I use the following code to show the relevant taxonomy

    <?php if (get_the_terms($post->ID, ‘features’)) { $taxonomy = get_the_terms($post->ID, ‘features’);
    foreach ($taxonomy as $taxonomy_term) {
    ?>

    • <?php echo $taxonomy_term->name;?>
    • <?php }
      }
      ?>

      I used the example php code but now it shows all tags and tag groups without the filter for only the features of the chosen car. How can i change the code to get it filtered?
      THX Freek

      https://www.ads-software.com/extend/plugins/tag-groups/

Viewing 13 replies - 1 through 13 (of 13 total)
  • If you want to use the groups created with the Tag Groups plugin, you you have to use it when you create the output. Your code just seems to retrieve all terms of a post.

    If you want to use the groups created with the Tag Groups plugin, you also have to use it when you create the output. Your code just seems to retrieve all terms of a post.

    Thread Starter ttc2003

    (@ttc2003)

    I use the
    <?php if ( function_exists( ‘tag_groups_cloud’ ) ) echo tag_groups_cloud( array( ‘include’ => ‘1,2,3,4,5’ ) ); ?>
    code, to show the Tag Groups and taxonomies, but it shows all Taggroups (which is good) and all taxonomies (which is not good) because i want to show only the relevant taxonomies which are assigned to this post.
    Is it possible to set some kind of filter in the php statement . Something like :
    <?php if (get_the_terms($post->ID, ‘features’)) {
    $taxonomy = get_the_terms($post->ID, ‘features’);
    foreach ($taxonomy as $taxonomy_term) {
    THX

    For the time being you will probably need to retrieve the array and filter out tags that are not assigned to the post. There is a future version in the making that will offer the option to display only tags that are connected to one post. Just needs some more testing.

    … or you check the latest version. ??

    Thread Starter ttc2003

    (@ttc2003)

    I installed the latest version 0.10. In my PHP file i use the code:
    <?php if ( function_exists( ‘tag_groups_cloud’ ) ) echo tag_groups_cloud( array( ‘include’ => ‘1,2,3,4,5’ ) ); ?>, because i have 5 Tag-groups and i want all taxonomies which are related to the current post.
    It still displays all taggroups and all taxonomies. How can i set the filter in the PHP code to only see the groups and taxonomies for the current post?
    THX Freek

    Your code looks like you have not yet added the required parameters.

    You could try:

    echo tag_groups_cloud( array( 'include' => '1,2,3,4,5', 'tags_post_id' => 0, 'hide_empty_tabs' => 1 ) );

    The taxonomy is always the one that you have chosen in the settings.

    One more thing: Since you use ‘include’, the tag groups with IDs 1 to 5 will always be displayed. It would make more sense to omit the 'include' => '1,2,3,4,5', part.

    Thread Starter ttc2003

    (@ttc2003)

    Super! Thanks. It works!

    One final question:
    How about formatting? I want all results displayed in two rows with a bullet before every item like this:
    * option 1 * option 2
    * option 3 * option 4
    etc..
    THX again
    Freek

    You could try to add to your css something like

    .ui-tabs-panel a { … }

    where you define a background image for the bullets and create columns according to https://www.w3schools.com/css3/css3_multiple_columns.asp

    If you want to output the tags as table, you probably won’t avoid retrieving the tags as an array and then creating your cloud from scratch. This may help you: https://www.christoph-amthor.de/software/tag-groups/examples-applications/#Display_tags_in_columns

    Thread Starter ttc2003

    (@ttc2003)

    Thanks again. In the themeroller setup i can change some things as tag cloud colors, font settings etc.. Also there is a section with framework icons. Is it possible to show an icon as separator? Now i use the following code:

    <?php if ( function_exists( ‘tag_groups_cloud’ ) ) echo tag_groups_cloud( array( ‘include’ => ‘1,2,3,4,5’, ‘tags_post_id’ => 0, ‘hide_empty_tabs’ => 1, ‘smallest’ => 12, ‘largest’ => 12, ‘separator’ => “?”, ‘separator_size’ => 18 ) ); ?>

    I want to use an other separator. Is it possible?
    THX
    Freek

    You can choose the separator via the parameters. I cannot answer questions about the theme roller or customizations. The styling options assume that you are familiar with css and that stuff. If not, there are many instructions on the web, just google it.

    Thread Starter ttc2003

    (@ttc2003)

    Thanks for your support. I appreciate it very much.
    Case closed!
    Freek

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Tags grouped’ is closed to new replies.