Support » Plugin: CPT-onomies: Using Custom Post Types as Taxonomies » display the field of posttype/taxonomy on frontend

  • Resolved neha


    i have a posttype called store with fields “title” and “genre”.

    i ahve thisposttype store set a CPTnomies to posttype called books as checklist which lists the store titles as checkbox

    now i am trying to display on the front end the store selected and based on the selection the corresponding genre too.

    i am unable to get that when i use <?php echo get_terms(‘genre’);?> it gives me error….how do i get the desired output.


Viewing 5 replies - 1 through 5 (of 5 total)
  • neha


    instead of custom field how can get the post’s permalink to be displayed for the selected store title…i have tried everything nothing seemss to work

    Plugin Author Rachel Cherry


    Well, get_terms( ‘genre’ ) doesn’t work because ‘genre’ is a custom field and not a taxonomy or CPT-onomy.

    As for the permalink, you have to get the selected store’s ID using wp_get_object_terms() and then use get_permalink():

    // $post_id is the post ID of the current book
    // I don't know the context of your code so you may
    // have to replace this with your own info.
    $stores = wp_get_object_terms( $post_id, 'actors' );
    // $stores will contain arrays of info for each store
    // that is assigned to the book, including the store's
    // term_id which is the same as the store's post ID.
    if ( $stores && !is_wp_error( $stores ) ) {
       echo '<ul>';
       foreach ( $stores as $store ) {
          echo '<li><a href="' . get_permalink( $store->term_id ) . '">' . $store->name . '</a></li>';
       echo '</ul>';

    I hope this helps!



    is there any way to get the custom field in the posttype to be echoed after its converted to cpt-onomy?

    p.s-thanx so much replying 🙂



    racehl with the code u gave …it pulls in the permalink of the current as well as the previous post from the CPT…is it pulling 2 of them



    also it pulla in the permalink of the post and not the cpt

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘display the field of posttype/taxonomy on frontend’ is closed to new replies.