This topic has 5 replies, 3 voices, and was last updated 8 years by sharmstr.

  • Author
  • #55565
     adasin
    Participant

    How can include the terms of a custom taxonomy in on single post meta block?

    I registered the taxonomy as such:

    COPY CODE
    add_action( 'init', 'build_taxonomies', 0 );
    function build_taxonomies() {
    register_taxonomy( 'levels', array('post','my_cpt'), array( 'hierarchical' => true, 'label' => 'Levels', 'query_var' => true, 'rewrite' => true ) );
    }

    and have experimented with the function kleo_entry_meta in child by adding:

    COPY CODE
    if ( in_array('levels', $meta_elements ) ) {
                        //$levels_list = get_the_term_list( $post->ID, 'levels', '', ', ', '' );
                        
    			$levels_list = get_the_term_list('', __(', ', 'kleo_framework'));
    		}

    and further down the same function:

    COPY CODE
    if ( isset( $levels_list ) && $levels_list ) {
    			$cat_tag[] = $levels_list;
    		}

    But none of the selected terms show up in normal post. Not sure if this the right way of doing it.

    Would appreciate some guidance on this.

    #55602
     sharmstr
    Moderator

    It wont show up because

    COPY CODE
    
    if ( in_array('levels', $meta_elements ) ) {
    

    will always return false unless you’ve also added “levels” to Theme Options > Blog > Display Meta Fields. Just dont check for it.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #55855
     adasin
    Participant

    Many thanks sharmstr for the tip.

    #55859
     sharmstr
    Moderator

    Just a heads up. That function has changed in the next update. Make sure you recopy the function to your child theme after you update.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #73330
     pandreas82
    Participant

    Hello sharmstr,

    I have a similar problem.

    I have created a custom taxonomy with “Custom Post Type UI 1.1.1” plugin but there is no option to add it at “Display Meta Fields” list.

    What is wrong here??

    Regards,

    Andreas

    Attachments:
    You must be logged in to view attached files.
    #73387
     sharmstr
    Moderator

    They wont show up there. As the original poster indicated, you need to edit the kleo_entry_meta function.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

Viewing 6 posts - 1 through 6 (of 6 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?