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

  • Author
  • #59027
     ImG
    Participant

    I have created custom post type using “Custom Post Type UI” plugin, In theme options-> Display meta fields i have selected “Categories” to show and turn on-> Display post meta on archive listing, Display post meta in Single post page, but categories are not showing on custom post type single post page and cpt archieves, how to solve this issue, and also social share and post likes are not showing on cpt pages, what to do?

    #59142
     Laura
    Moderator

    Hello, have you tried talking to the plugin support forum? You can also share your admin credentials so i can check it out 🙂

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #59162
     ImG
    Participant
    This reply has been set as private.
    #59185
     sharmstr
    Moderator

    Have you enabled social sharing for your CPT? Theme Options > Social Share > Social share Post types

    That’s correct. Kleo uses WP taxonomies. You can either enable WP categories for your CPT or you can copy the kleo_entry_meta() function located in /kleo/functions.php into your child them and add it yourself. You can use this function to retrieve them: https://codex.wordpress.org/Function_Reference/get_the_terms

    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

    #59189
     sharmstr
    Moderator

    I just found some code I used on another site over a year ago. Totally forgot about it. See if this helps.

    At the top of the kleo_entry_meta function you’ll see.

    COPY CODE
    
    // Translators: used between list items, there is a space after the comma.
            if ( in_array( 'categories', $meta_elements ) ) {
                $categories_list = get_the_category_list(__(', ', 'kleo_framework'));
            }
    

    Try something like this instead.

    COPY CODE
    
    
    if (get_post_type() == 'projects') {
    	$categories_list = get_the_term_list( $post->ID, 'project-category', '', ', ' );		
    } else {
    	// Translators: used between list items, there is a space after the comma.
          if ( in_array( 'categories', $meta_elements ) ) {
              $categories_list = get_the_category_list(__(', ', 'kleo_framework'));
           }
    }
    

    Be sure to change projects and project-category to match your setup.

    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

    #59190
     sharmstr
    Moderator

    Again, make sure you put it in your child theme’s function.php file.

    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

    #59370
     ImG
    Participant

    Hi the code what you have given doesn’t retrieve any category attached to Projects CPT, I have placed this code in functions.php of child theme`
    if (get_post_type() == ‘project’) {
    $categories_list = get_the_term_list( $post->ID, ‘project_categories’, ”, ‘, ‘ );
    } else {
    // Translators: used between list items, there is a space after the comma.
    if ( in_array( ‘categories’, $meta_elements ) ) {
    $categories_list = get_the_category_list(__(‘, ‘, ‘kleo_framework’));
    }
    }`
    Any solution!

    #59371
     sharmstr
    Moderator

    You have to put the entire kleo_entry_meta function into your child functions.php file. Not just the code I told you to change.

    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

    #59527
     ImG
    Participant

    Hi, Can you tell me in which file kleo_entry_meta function is located?

    #59532
     sharmstr
    Moderator

    I did 🙂

    you can copy the kleo_entry_meta() function located in /kleo/functions.php

    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

    #59691
     ImG
    Participant

    Hi, I have placed entire kleo_entry_meta() function but it is not working, i thing if it works it will work for project cpt, for other post type it won’t work, Here is the code that i have placed in functions.php`if ( ! function_exists( ‘kleo_entry_meta’ ) ) :
    /**
    * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
    * Create your own kleo_entry_meta() to override in a child theme.
    * @since 1.0
    */
    function kleo_entry_meta($echo=true, $att=array()) {

    global $kleo_config;
    $meta_list = array();
    $author_links = ”;
    $meta_elements = sq_option( ‘blog_meta_elements’, $kleo_config[‘blog_meta_defaults’] );

    if (get_post_type() == ‘project’) {
    $categories_list = get_the_term_list( $post->ID, ‘project_categories’, ”, ‘, ‘ );
    } else {
    // Translators: used between list items, there is a space after the comma.
    if ( in_array( ‘categories’, $meta_elements ) ) {
    $categories_list = get_the_category_list(__(‘, ‘, ‘kleo_framework’));
    }
    }

    // Translators: used between list items, there is a space after the comma.
    if ( in_array(‘tags’, $meta_elements ) ) {
    $tag_list = get_the_tag_list(”, __(‘, ‘, ‘kleo_framework’));
    }

    $date = sprintf( ‘<a href=”%1$s” rel=”bookmark” class=”post-time”>’ .
    ‘<time class=”entry-date” datetime=”%2$s”>%3$s</time>’ .
    ‘<time class=”modify-date hide hidden updated” datetime=”%4$s”>%5$s</time>’ .
    ‘</a>’,
    esc_url( get_permalink() ),
    esc_attr( get_the_date( ‘c’ ) ),
    esc_html( get_the_date() ),
    esc_html( get_the_modified_date( ‘c’ ) ),
    esc_html( get_the_modified_date() )
    );`
    Any solution!

    #59728
     sharmstr
    Moderator

    I dont know what to tell you. The code works for me. Have you tried troubleshooting? Have you verified that

    COPY CODE
    get_the_term_list( $post->ID, ‘project_categories’, ”, ‘, ‘ );

    returns something?

    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 12 posts - 1 through 12 (of 12 total)

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

Log in with your credentials

Forgot your details?