Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter the_fear66

    (@the_fear66)

    ^^ — ^^

    Thread Starter the_fear66

    (@the_fear66)

    In case anyone is interested I managed to get this working like this:

    <?php while (have_posts()) : the_post(); ?>

    <?php
    global $wpdb;
    $artist_name = get_post_meta($post->ID, Artist, true);
    $id = $wpdb->get_var(“SELECT wp_posts.ID FROM wp_posts, wp_postmeta, wp_post2cat WHERE wp_posts.ID = wp_postmeta.post_id AND wp_posts.ID = wp_post2cat.post_ID AND category_id = 3 AND wp_postmeta.meta_key = ‘Artist’ AND wp_postmeta.meta_value = ‘$artist_name'”);
    $url = get_permalink($id);
    ?>

    <div class=”item”>
    <div class=”gallerypic”>
    <div class=”desc”>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></div>
    <img width=”140″ height=”140″ src=”<?php the_excerpt_reloaded(); ?>” alt=”<?php the_title(); ?>” /></div>
    <div class=”artist”>by “><?php echo $artist_name; ?></div>
    </div>

    <?php endwhile; ?>

    Anyone got any ideas about how I might link to the post in category 3 which shares the same ‘Artist’ value as each artwork?

    And what about tags? Isn’t it simpler?

    Thread Starter the_fear66

    (@the_fear66)

    no idea – i think the mix of custom fields being used to link posts in different categories means the tags were rendered a bit useless, but I might be wrong.

    Anyhoo, this works for me, so I’m happy.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Create link to associated post in different category’ is closed to new replies.