Forums

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

Home Forums Back End Need help for custom post type

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #277360
    RealboyAdnan
    Participant

    I have created custom post type, and also created some categories,
    Now the point is, i want to show the category name on the custom post type single page.

    Please provide me the code for showing the custom post type category on a single page.

    #277369
    carmine96
    Participant

    Try this for wp:

    <?php
    
    $taxonomy = 'your taxonom';
    $terms = get_terms($taxonomy); // Get all terms of a taxonomy
    
    if ( $terms && !is_wp_error( $terms ) ) :
    ?>
        <ul>
            <?php foreach ( $terms as $term ) { ?>
                <li><a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?></a></li>
            <?php } ?>
        </ul>
    <?php endif;?>
    
    ?>
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.