Forums

Show tags and posts for a selected category. (8 posts)

  1. skina
    Member
    Posted 4 years ago #

    Hi,

    I would like to generate a Tag Cloud on my static home page which contains only the tags of a given category. I was thinking something along the lines of:

    wp_tag_cloud('category=news');

    Is it possible?

    What's the best method of showing the most recent posts of a given category?

  2. Kafkaesqui
    Moderator
    Posted 4 years ago #

    "I would like to generate a Tag Cloud on my static home page which contains only the tags of a given category."

    Yikes.

    I know of nothing at present which does this, so what you're looking at is having to create a (complicated, but doable) query that would collect those tags.

    "What's the best method of showing the most recent posts of a given category?"

    Just visit the category. Or is this a trick question? ;)

  3. skina
    Member
    Posted 4 years ago #

    Thanks for the reply.

    I'll have a crack at that query and let you know how I get on.

    The second question wasn't a trick but I figured it out (actually, I read the documentation properly). All I needed to do was:

    $postslist = get_posts('category=7&numberposts=10&order=DESC&orderby=post_date');
            if (true === !is_array($postslist)) :
                ?><li>No Posts</li><?
            else : foreach ($postslist as $post) :
                setup_postdata($post);
                ?><li><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></li><?
            endforeach;
            endif;

    The above code shows the 10 most recent posts from my selected category (id=7) on my sidebar (i.e. on any page on the site)

  4. Indojepang
    Member
    Posted 4 years ago #

    wp_tag_cloud('category_name=news');

    It would be a Excellent function if it exist! Unfortunately it's not!
    Waiting for this to happen too.. :)

    Meanwhile the solution I know is using this pluginhttp://thedeadone.net/software/tdo-tag-fixes-wordpress-plugin/
    It works in my test with WP 2.5

    wp_tag_cloud('category_name=news'); Yes! I WANT THIS!

  5. ThreeVisual
    Member
    Posted 3 years ago #

    I'd also like to see this function, anyone able to build a plugin that would allow it?

  6. zyrq
    Member
    Posted 3 years ago #

    +1 for this

  7. desmondo
    Member
    Posted 3 years ago #

    Me too!

  8. webgirl
    Member
    Posted 3 years ago #

    Sounds like a simple and great function that should be added.

Topic Closed

This topic has been closed to new replies.

About this Topic