• Hi guys,

    On a site I’m doing for a record label I’ve set up the sidebar to show a list of Gigs if on any Artist’s page (post) using The Loop as follows:

    <?php query_posts(‘category_name=gigs&showposts=5’); while(have_posts()) : the_post(); ?>

    This is pretty simple stuff, but now I would like to only display that particular Artist’s Gigs.

    The logic I’ve figured out for this is to add the Gigs to both the “Gigs” category and a category named after the Artist. I would also need to add the Artist to both the “Artists” category and it’s own category named after the Artist.

    So then I would only need the code to say:

    <IF post is in “artist_name” AND “gigs” display here>

    Can’t figure it out for the life of me though, can any of you guys help?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter SpencerLavery

    (@spencerlavery)

    No ideas? I’ve posted three different help topics (on different subjects) over the past few months and not received a single reply on any of them. Am I doing something wrong? 🙂

    I don’t think you are doing something wrong, your question is phrased well and you give every information that’s needed (IMO). Maybe there is no solution with the current category system? I don’t use categories at all, so I really don’t know.
    I might have a solution based on a modified version of Ultimate Tag Warrior, but I need to test my idea first.

    Ok, my idea did not work out, so unless I miss something you can’t “simulate” the desired effect with tags, sorry.

    Thread Starter SpencerLavery

    (@spencerlavery)

    Thanks for trying though TimoK, I appreciate it very much! If I ever find a solution I will be sure to post it here.

    I may even need to resort to asking one of our php developers , gasp!

    Thread Starter SpencerLavery

    (@spencerlavery)

    Bumping this to see if anybody has any ideas.

    Never actually done this, but give it a shot. Idea is coming from the in_category template tag.

    <?php query_posts('category_name=gigs&showposts=5'); while(have_posts()) : the_post(); ?>
    
    <?php if ( in_category('artistcategorynumber') ): ?>
      The Stuff you Want to Display Here
    <?php endif; ?>
    
    <?php endwhile; ?>
    Thread Starter SpencerLavery

    (@spencerlavery)

    Whilst that solution would still list all of the Gigs regardless of which Artist they are assigned to, you are definitely onto something with the “if ( in_category” addition.

    I’ll play around and see if I can come up with something.

    Thanks so much for your help, I think that was the missing part of the logic that I’ve needed. Still feels like a hack however it’s better than nothing.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘The Loop and Cross-Category Posts.’ is closed to new replies.