• greencode

    (@greencode)


    Not sure what I’m doing here but I usually use the

    <p>This post is in: <?php the_category(', '); ?></p>

    to list the category’s that the post is in on the single.php template. What code do I need to use in order to display the custom category order. I’ve tried

    <?php $argv = array(
    'orderby'       =>  'term_order',
    'hide_empty'    => false
    );
    get_terms('the_category', $argv); ?>

    and it’s not displaying anything But isn’t the get_terms only used for custom post types? I’m just using standard posts.

    Any help would be really appreciated as I’m losing my mind!

    http://wordpress.org/extend/plugins/taxonomy-terms-order/

Viewing 1 replies (of 1 total)
  • Plugin Author nsp-code

    (@nsp-code)

    Using the get_terms will not output anything as it will return a value and not an output. I suggest so you check with http://codex.wordpress.org/Function_Reference/get_terms on the way this WordPress function work.
    Here’s a fast example on a simple usage:

    $argv = array(
    ‘orderby’ => ‘term_order’,
    ‘hide_empty’ => false
    );
    $found_terms = get_terms(‘the_category’, $argv);
    if ( count($found_terms) > 0 ){
    echo “

      “;
      foreach ( $terms as $term ) {
      echo ”

    • “.$term->name . “
    • “;
      }
      echo “

    “;
    }

Viewing 1 replies (of 1 total)

The topic ‘category order when listing within post’ is closed to new replies.