Software

A Plugin

Eventually I decided to publish a plugin that I initially wrote for the EcoBurma website to replace another one that led to loads of error messages and that could not be customized the way I needed it. Its purpose is to enable post tags to be sorted into groups. Now I can display the tags in different tag clouds, for example grouped by language:

 

The main work was about writing the code in a „nice way“, i.e. readable, and uploading the files via svn to the WordPress repository. And, of course, once the plugin is out in the wild, you immediately discover some little things that you would like to change.

Wow, already 16 downloads!

20 Kommentare

  1. Jan sagt

    Hey Christoph,

    genau so etwas habe ich bisher vergeblich gesucht, vielen Dank dafür 🙂 !!

  2. Ryan M sagt

    Hello,

    There appears to be a bug with Tag Groups v 0.5 and WordPress v3.4.1. When creating menus from appearance -> menus an error is displayed on save.

    „Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\wamp\www\wordpress\wp-includes\taxonomy.php on line 2337“

    I unfortunately don’t have the WP knowledge to try and fix this myself but thought I would let you know.

    Regards

    • It could be done by modifying the existing WordPress plugin for 3D tag clouds using TagCanvas.
      In that plugin you edit the file tagCloud-html5.php and replace that function wp_tag_cloud() by echo tag_groups_cloud( ...) … or just for testing with echo tag_groups_cloud( array( 'show_tabs' => 0 , 'include' => '1' ) );. If you want to have a different group for each category, you can find an example how to do it here.
      You probably want to save it as new plugin – otherwise your custom changes will be lost next time you update that plugin.

  3. Wolf Larsen sagt

    Servus Christoph,

    kann man die Gruppen der Tags irgendwie in den Permalinks anzeigen? Ich habe eine Gruppe „Referenzen“. Dort sind Tags eingeordnet etwa „Ausland“ und „Merkur“. Der Permalink sollte dann z.B. /referenzen/ausland oder /referenzen/merkur sein.

    Ich bedanke mich so oder so,

    Wolf

  4. How can I call just the Group name in a page template. I want to display both the tag when seleceted and which group it is in on separate lines

    • The only way I can think of now is to retrieve the array (last parameter must be „true“) and then filter out the required information. Maybe you can get some inspiration here. If you have the group name, you can get the term_group and then display all tags that belong to that group.

  5. Sam sagt

    Hello,

    I’m trying to implement your code to add into my address bar.

    I have groups set for my tags and would like the tags to link to page categories.

    Is it possible to call the name of the group rather than the number?
    $tag->term_group

    e.g.
    I have a page and a category named ‚people‘. I have a tag called ‚joe blogs‘ but I would like it to link to the category/page ‚people‘.

    This is what I have so far:
    <?php
    $tags = get_the_tags();
    $html = 'Tags: ‚;
    foreach ( $tags as $tag ) {
    $tag_link = get_tag_link( $tag->term_id );

    $html .= „slug}‘ title='{$tag->description}‘ id='{$tag->slug}‘ class=’group“ . $tag->term_group . “ tag‘>“;
    $html .= „{$tag->name}
    \n“;
    }
    $html .= ‚‚;
    echo $html;
    ?>

    I hope this makes sense. Could you point me in the right direction?

    Regards,
    Sam

    • Hi Sam, I think your code doesn’t display correctly.

      So you want to have the name of the group for a given $tag->term_group?

      You could simply retrieve the labels directly from the options:

      $tag_group_labels = get_option( ‚tag_group_labels‘, array() );
      $tag_group_ids = get_option( ‚tag_group_ids‘, array() );

      $i = array_search($tag->term_group, $tag_group_ids);

      $group_name = $tag_group_labels[$i];

      I haven’t tested it now, hope it works.

  6. Sam sagt

    Cheers, works.

    I’ve got duplicate IDs but I’ll assimilate those.

    Making my tags link to posts (with the same name).

    Thanx again.

  7. Announcement: The latest version 0.10 offers the option to display a tag cloud that filters the tags according to the tags of particular posts and pages. That has been a frequent request.
    Also added a new link for donations: http://www.burma-center.org/donate/ Money doesn’t go to me but to my favourite charity. 😉

Kommentare sind geschlossen.