WordPress.org

Ready to get started?Download WordPress

Forums

Plugin for Category / Tag Specific "Blogroll" (2 posts)

  1. Louno
    Member
    Posted 4 years ago #

    Hi,
    My site has many different categories and tags, I would like to display different things on the sidebar depending on the category/tag pages that is being displayed...

    For example, if someone clicks on the tag "photoshop tutorials" then on that tag page there will be a list of my post tagged with that tag but I would also like to display on the right sidebar some related ressources, a few links to different website which offer photoshop tutorials essentially...

  2. MichaelH
    Member
    Posted 4 years ago #

    So put categories on the links (blogroll resources) that are the same as your post tags, then if you are looking at a tag page display the links that tag as a category. Example:

    <?php
    //if tag archive, then use that tag to retrieve links that belong to the category equal to that tag
    if (is_tag( )) {
      $qtag = get_query_var('tag');
      $tag = get_term_by('name',$qtag, 'post_tag');
      if ($tag) {
        $args=array(
          'category' => $tag->term_id,
          'categorize' => 0,
          'title_li' => 'Related Links'
          );
        wp_list_bookmarks($args);
      }
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic