Forum Replies Created

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

    (@noartworkavailable)

    Holy moly. HOLY MOLY!

    It works! and it works perfectly!
    Thank you so so so much!

    Thread Starter noartworkavailable

    (@noartworkavailable)

    Ah ha! You’re great! using get_the_terms() I was able to get it to find the pages of the associated taxonomy term. The problem that I’m having now is that on posts without any taxonomy term specified, it still shows some pages, just seemingly random ones.

    Is there a way to tell it to hide my list when there are no taxonomy terms assigned? I was trying to do it with if(is_object_in_taxonomy( ‘post’ , ‘artist’ )) {} but I can’t get it to work yet.

    <?php
        if(is_object_in_taxonomy( 'post' , 'artist' )) {
        	$arterms = get_the_terms( $post->ID, 'artist' );
        	foreach( $arterms as $artax );
        	}
        $query = new WP_Query( array(
       		'festivals' => "$artax->slug" ,
       		'post_type' => 'page',
       		'order' => 'ASC'
       	 ) );?>
            <ul>
            <?php while ( $query->have_posts() ) : $query->the_post();?>
            <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></li>
    
        <?php endwhile;?>
           </ul>
    Thread Starter noartworkavailable

    (@noartworkavailable)

    A custom field wouldn’t be practical as I’d have to start anew (as opposed to the custom taxonomy which has been already previously defined).

    With taxonomy templates, as I understand it, you can only make archive pages for custom taxonomy templates and not for individual posts. The code I’m trying to use above is to put on the single-post templates that are members of a term in a custom taxonomy.

    Thread Starter noartworkavailable

    (@noartworkavailable)

    Where would I stick $current in the query? When I change ‘artist’ => ‘HARDCODEDTERM’ to ‘artist’ => ‘$current’ or to ‘artist’ => $current, it doesn’t load the template anymore. Any suggestions?

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