WordPress.org

Ready to get started?Download WordPress

Forums

Ultimate Tage Waqrrior: show tags for a category (4 posts)

  1. sevennine
    Member
    Posted 7 years ago #

    Just to set the stage, I have two different categories in my WP blog, one for weblog entries and another for quicklinks (i.e. extranal links)

    Instead of getting a tag cloud for all the weblog and quicklink entries combined, I was wondering if anyone knew of a way to get two different tag clouds? eg a tag cloud for the quicklink entries and one for the weblog entries.

    I've scanned the documentation and can't seem to find it (I may be missing it) and the support forum isn't running for the plugin.

  2. Andy Beard
    Member
    Posted 7 years ago #

    Just trying to apply some logic to it

    Categories and tags are not automatically interconnected, but they can easy be interconnected if you use the category name as a tag as well.

    Then you have a tag that is related to all the other tags in the same category, that you can use to build a cloud specific to the category.

  3. Vimma
    Member
    Posted 7 years ago #

    I have quite similar problem, several different categories, and I'd like to show category specific tags. AndyBeard's solution would work, but I don't want to abandon my categories.

    Tag warrior can be configured to automatically add categories as tags, so I wonder, can I somehow hack the wp template tag "list_cats", so that it would link to a tag instead of category? Or should I code a new plugin that would do it?

    Any help would be appreciated.

  4. Vimma
    Member
    Posted 7 years ago #

    I got it working using the code snippet below. Now I can still use the categories, but when a user clicks a category, she actually clicks a tag with the same name.

    <?php //get list of categories
    $cats = @$wpdb->get_results("
    SELECT DISTINCT wp_categories.cat_ID, wp_categories.cat_name, wp_categories.category_nicename
    FROM wp_post2cat
    LEFT JOIN wp_categories
    ON wp_post2cat.category_id = wp_categories.cat_ID
    LEFT JOIN wp_posts
    ON wp_post2cat.post_id = wp_posts.id
    WHERE wp_posts.post_status='publish' AND wp_categories.category_parent=0
    ORDER BY wp_categories.cat_name
    ");
    if($cats) : foreach($cats as $cat) : start_wp();
    ?>
    <li>
    <a>category_nicename?>"><?php echo $cat->category_nicename?></a>
    </li>
    <?php endforeach; endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic