• Hello!

    It’s a bit difficult to explain, but here goes.

    I’m trying to create a taxonomy archive which shows 1) pages where the person is tagged and 2) posts where the person is tagged.

    The problem is, however, that the tag on the page is different from the tag on the post

    Page: /skuespiller/tag/
    Post: /tag/tag/

    You can see the page here: http://seriezonen.dk/skuespiller/jim-parsons/

    Where it says “Nyheder om Jim Parsons:” I want it to show the related posts he’s tagged in (http://seriezonen.dk/tag/jim-parsons/) but I can’t figure out how to do it.

    Here’s my code (it might be messy – i’m not in any way an developer)

    <?php
    /**
     * Blog page (Default Style)
     *
     * @package primetime
     */
    //get_header();
    get_header();
    ?>
    
    <div id="primary" class="site-content">
    <div id="content" role="main">
    
      <h2><?PHP $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?> </h2>
    <div><?PHP  echo term_description( '', get_query_var( 'taxonomy' ) );
    global $wp_query, $shortname; ?></div>
    
      <strong><?PHP $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?> har medvirket i:</strong>
    <?php while ( have_posts() ) : the_post(); ?>
    
    <li class="sedb"><a href="<?php the_permalink(); ?>" class="sdb" title="<?php printf( esc_attr__( 'Link til %s', 'maggie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></li>
    
    <br>
        <strong>Nyheder om <?PHP $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?>:</strong>
      <li class="sedb"><a href="http://www.seriezonen.dk/tag/<?php
        $tag = get_queried_object();
    echo $tag->slug ?>/" class="sdb" title="<?php printf( esc_attr__( 'Link til %s', 'maggie' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></li>
    
       <?php endwhile; ?>
    
    </div><!-- #content -->
    </div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

  • The topic ‘Trouble with tags’ is closed to new replies.