I’ve made a custom post type called “Education”. With this custom post type I made a custom taxonomy by the name of “Years”. Say I were to add roughly around 10 posts for this custom post type in this format:

title of custom post type (Education), Custom Taxonomy Name (Year)

How would I display on my page the title of the post and it’s taxonomy name in sequential order?

(like so)

Vimy College      2014
Albatross         2013
Some College      2011
Another College   2010

Here’s the code for my page so far:

<?php /* Template Name: Education Page */
get_header(); ?>

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

    // The args here might be constructed wrong
    $args = array( 'post_type' => 'education', 
                   'terms' => 'years', 
                   'orderby' => 'terms', 
                   'order' => 'ASC');

    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();

        echo '<h3>';
        echo '</h3>';

        // I don't know what else to put here to display the associated taxonomy name
        // (and in sequential order)



<?php endwhile; endif; ?>

So to clarify, the first have_posts() loop just echoes out the actual page, and the inner loop is supposed to generate the format mentioned above for listing the post titles but ordered by the custom taxonomy name (in this case, numerical).

Any help would be greatly appreciated.

Read more here: WordPress: Display Custom Post Type Alphabetized by Custom Taxonomy?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: