Forum Replies Created

Viewing 3 replies - 76 through 78 (of 78 total)
  • Aha! So the latest update adds a check in the other direction. Right now I don’t need it, but I guess it might be interesting to display the current tag_group for a post.

    I will share though what I added to my template :

    // Load the tag groups
    if ( function_exists("tag_groups_cloud") ) $tag_groups = tag_groups_cloud( array( 'orderby' => 'count', 'order' => 'DESC' ), true );
    
    // Go through each tag group
    while ( $current_tag_group = array_shift($tag_groups) ){
      echo "<h1>".$current_tag_group["name"]."</h1>";
      // Show the top tags from the tag group with count
      // TODO : Add limit
      foreach($current_tag_group["tags"] as $value){
        echo "<a href='".$value["link"]."'>".$value["name"]."</a><sup>".$value["count"]."</sup> ";
      }
      // Get the tags for the tag group into array
      $current_tags = array();
      foreach($current_tag_group["tags"] as $value){
        $current_tags[] = $value["slug"];
      }
      // Get 5 articles based on the tags we extracted for the tag group
      $args = array('posts_per_page' => 5, 'tag' => implode(",",$current_tags));
      $three_recent = new WP_Query($args);
      if ( $three_recent->have_posts() ) :
        while ( $three_recent->have_posts() ) : $three_recent->the_post();
        // the_post loop, show content here
        endwhile;
      endif;
    }

    Great stuff! Thanks.

    One thing though, in the documentation please change
    <?php if ( function_exists( tag_groups_cloud ) ) print_r( tag_groups_cloud( array( 'order' => 'count' ), true ) ); ?> to
    <?php if ( function_exists( tag_groups_cloud ) ) print_r( tag_groups_cloud( array( 'orderby' => 'count', 'order' => 'DESC' ), true ) ); ?>

    Cheers!

    Great! Will do that, thanks

Viewing 3 replies - 76 through 78 (of 78 total)