Support » Fixing WordPress » Trouble creating easy linked list of tags

  • I know this should be simple but I feel like I’ve downloaded every type of widget and can only find ones that are sidebar savvy…

    I’m (eventually) going to have lots of posts with different tags on each one (so Asparagus, Poached Eggs, and Goat Cheese all tagged). I’d like to be able to create linked lists for those tags so there is an “Asparagus” section with a linked list underneath to all the recipes that have Asparagus tagged in them.

    Something like this: but with less manual updating? It looks manually updated.

    Maybe I’m making it harder, or there’s an easier way to organize them, if so feel free to share!

    URL: if you need it

Viewing 15 replies - 1 through 15 (of 19 total)
  • alrighty, unless someone can think of a plugin (which I’m sure is out there) there’s a few ways. If you specify the post category(ies)id(s) in this code, it will return all the tags from those categories (or category) in a linked list without duplication.
    you’ll use it outside the loop in a page template, or make a custom template just for this.
    Should also work in a php widget, if you should change your mind about that.

    if you use it outside the loop in a page template for your theme, wrap it in:

    <?php if (is_page('page-slug')) { ?>
    code goes here	
    <?php } ?>

    just supply the page(slug) that you want it to appear on.

    First, thanks for the help 🙂

    I’m positive I’m putting this coding in on the wrong spot. I took the stuff out of paste bin that you sent, but I’m not sure exactly where to place it.

    Sorry I’m a bit novice, it’s what happens when you put down coding for years.

    The list of things will be on a page, in the content section, not the sidebar if that helps.

    Of course, any help would be greatly appreciated.

    I wouldn’t know how to make it part of the actual content area, that’s done in the page editor as far as I know.

    You have to place the code outside the loop, in a page template, no matter if custom or that of your theme.

    if you don’t have any other content on the page that you added in the page editor, then your list will appear as though it is the content.

    if you want additional content on the page with your tag list, it will still show up, either above or below your tag list, depending on if you place the code before or after the loop.

    try it yourself first, place the code directly after “if have posts”,
    or at the bottom of the page after directly after where it says “endif”.

    If necessary, post your page code in pastebin and give me the link I’ll show you.

    Good luck!

    Without thinking too much, does your tag cloud widget (as displayed in a widgetized area like a sidebar), take you to a roundup of all posts tagged asparagus when you click on asparagus? if so, you are 90% there.

    What you want to do differently is
    display the tag terms in the main column in list format instead of in a sidebar in cloud format?
    display the results of the clicked tag just as links to the post rather than post roundups or excerpts?

    this is a round up, is not formatted correctlty for a page? i do indeed use it in a widget. but I figured a list is a list. what might be changed to improve it?

    just looking at your site… I think if you just add some recipes it will become clearer to you how the whole thing works… functionally, everything you mention should happen automatically. from there, you might need to explore different themes or lift the hood to customize.

    I think you are right, I only use this because it allows me to specify tags in specific categories. However it will also serve sortagourmet’s purpose.

    And, actually it produces a list of all the post tiles that have the tag(s), as well as a link to the tag archive for each tag. So it kinda does it all, for a specific purpose I won’t bother to explain. I intended to post similar code which only shows the links to each tag’s archive, and not the post tiles. I’ll do that soon!

    Okay, this is wrong, sorry. it shows a linked list of all post titles (in a specific category) which share the same tag as the most recent post, a well as a link to that tag’s archive! (whew) Yikes! sorry! I’ll get back with what I intended asap if you’re still unresolved.

    at least if you get it to output where you want it you’ll be that much further ahead. I’ll be back.

    this is it, it’s basically like a tag cloud that allows you to specify a category.

        global $post;
        query_posts ('cat=1 &posts_per_page=1'); ?>
      <?php if ( have_posts() ) : ?>
     <?php while (have_posts()) : the_post(); ?>
    the_tags( __( ' ',
    ' ' ), ', ', '<br />'); ?> </p><?php
    $posttags = get_the_tags($post->ID);?>
        <?php endwhile; ?>
        <?php else : ?>
            <!-- html code if nothing found -->
        <?php endif; ?>
        <?php wp_reset_query();?>

    But as raskull say’s if you just want a tag cloud for all categories as a list on a page, I think that’s what a tag-template does. I suppose some themes have them, none that I’ve used do, or I never noticed.

    that one shows duplicates, no good. This one is tried and true if still interested.

    here’s a demo

    If your theme doesn’t have tag.php, the clicked tag will go to archive.php, filtered for your tag. If there is no archive.php, the clicked tag will go to index.php (your page for posts), filtered for your tag.

    Each of these templates serves the same purpose; but having all of them allows you to make a tag page look different than a category page look different than a news/blog/home page, etc.

    Check out the template hierarchy:

    and the tag template:

    turns out my theme has a tag page after all, but it doesn’t produce a list like the one in my demo, rather, it’s what displays all the posts which share the tag.

    I am thinking you — or at least the original poster — want to display all the posts that share a particular tag (correct me if I’m wrong). The issue is, do you want just the post title link to appear in the offerings, or the post title link and other details such as date, author, excerpt, etc. to appear? If so, then tweak templates.

    Otherwise… I think the original poster wants to offer access to all posts tagged “asparagus” (for example). That is what WordPress does in its sleep… Make post, tag post, go to sleep. Magic.

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Trouble creating easy linked list of tags’ is closed to new replies.