Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other List of terms in custom taxonomy

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #186356
    papdronning
    Participant

    This is probably really simple, but I can’t figure it out.

    On a WP-site I have a custom taxonomy called “forfatter” and I need to make a page that automatically lists all the terms in that taxonomy alpabetically.

    I have this … but that doesn’t work.

    `
    <?php
    /*
    Template Name: Forfatterarkiv
    */

    get_header(); ?>
    <?php
    //list terms in a given taxonomy
    $taxonomy = ‘forfatter’;
    $tax_terms = get_terms($taxonomy);
    ?>
    <ul>
    <?php
    foreach ($tax_terms as $tax_term) {
    echo ‘<li>’ . ‘<a href=”‘ . esc_attr(get_term_link($tax_term, $taxonomy)) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $tax_term->name ) . ‘” ‘ . ‘>’ . $tax_term->name.'</a></li>’;
    }
    ?>
    </ul>

    <?php get_footer(); ?>
    `

Viewing 1 post (of 1 total)
  • The forum ‘Other’ is closed to new topics and replies.