• Hi i’ve created a custom taxonomy
    but now i need a taxonomy ‘archive’ page,
    i created taxonomy.php and when i click on my
    taxonomy it takes me to the taxonomy.php page but i don’t know
    what code needs to be on the taxonomy.php page to display all posts
    tagged with that taxonomy, what code do i need?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter danielmck

    (@danielmck)

    ok i found out how to show all custom taxonomies on a page through

    <?php $custom_query = new WP_Query( array( 'custom-taxonomy') ); ?>
    
      <?php while ( $custom_query->have_posts() ) : $custom_query->the_post(); ?>

    now how do i show all posts tagged with one custom taxonomy?

    Thread Starter danielmck

    (@danielmck)

    Okay i did the archive wrong,
    I now have a page with a list of all tags in a custom taxonomy
    using:

    <?php
          $taxonomy     = 'custom';
          $orderby      = 'name';
          $show_count   = 0;
          $pad_counts   = 0;
          $hierarchical = 1;
          $title        = '';
    
          $args = array(
            'taxonomy'     => $taxonomy,
            'orderby'      => $orderby,
            'show_count'   => $show_count,
            'pad_counts'   => $pad_counts,
            'hierarchical' => $hierarchical,
            'title_li'     => $title
          );
    ?>
    
    <ul>
          <?php wp_list_categories( $args ); ?>
    </ul>

    And each tag list item goes to a page with all posts tagged with that custom taxonomy tag using taxonomy-custom.php and:

    <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
    
            <?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>

    Now is it possible to make this page a wordpress ‘page’ template
    so that for each taxonomy tag i have a new page using the same template
    in which the user can write a bit of info about the particular taxonomy tag?

    I created a page template using the taxonomy.php code but it doesn’t work because i’m guessing wordpress is using the archive.php instead through the template hierarchy?

    Hope i explained ok and thanks for any help

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

The topic ‘Taxonomy archive’ is closed to new replies.