-
Author
-
March 12, 2016 at 01:06 #110100
clyn
ParticipantI can add the tag, archive link, profile icon or categories to meta field. How can i add my taxonomies? I am usinging custum post types and want to show taxonomies on single posts…
Thanks
Attachments:
You must be logged in to view attached files.March 12, 2016 at 15:24 #110133sharmstr
ModeratorHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 12, 2016 at 16:45 #110142clyn
ParticipantI did not understand anything that forum topic… I can show tags, categories, archieve link, post date or profile link on single post or post layout… On this topic, i cant understand how to i add custom taxonomies?
what should i do with above forum topic (you send it), should i chance categories to taxonomies?
thanks
March 13, 2016 at 14:42 #110193sharmstr
ModeratorIn this post I explain that you need to copy kleo_entry_meta to your child theme: https://archived.seventhqueen.com/forums/topic/custom-post-type-meta-not-showing-on-single-posts-and-post-archieves#post-59185
And in this one https://archived.seventhqueen.com/forums/topic/custom-post-type-meta-not-showing-on-single-posts-and-post-archieves#post-59189 I explain how to add your custom taxonomy to the function so it will display on your CPT. You just need to change ‘projects’ to the name of your cpt and ‘project-category’ to the name of your custom taxonomy.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 14, 2016 at 15:37 #110347sharmstr
ModeratorWhat’s on line 30?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 14, 2016 at 16:50 #110380sharmstr
ModeratorYou didnt follow my instructions. I’ve explained that you needed to copy the kleo_entry_meta function located in /kleo/functions.php to your child theme FIRST. Then you need to change the code to suit your needs given the examples I’ve supplied. Here’s the function
COPY CODEfunction 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'] ); // 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')); } if (get_post_type() == 'portfolio-audition') { $categories_list = get_the_term_list( $post->ID, 'portfolio-country', '', ', ' ); } 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')); } } $date = sprintf( '<a href="%1$s" rel="bookmark">' . '<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() ) ); if ( is_array( $meta_elements ) && !empty( $meta_elements ) ) { if ( in_array( 'author_link', $meta_elements ) || in_array( 'avatar', $meta_elements ) ) { /* If buddypress is active then create a link to Buddypress profile instead */ if (function_exists( 'bp_is_active' ) ) { $author_link = esc_url( bp_core_get_userlink( get_the_author_meta( 'ID' ), $no_anchor = false, $just_link = true ) ); $author_title = esc_attr( sprintf( __( 'View %s\'s profile', 'kleo_framework' ), get_the_author() ) ); } else { $author_link = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); $author_title = esc_attr( sprintf( __( 'View all POSTS by %s', 'kleo_framework' ), get_the_author() ) ); } $author = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s %4$s</a>', $author_link, $author_title, in_array( 'avatar', $meta_elements ) ? get_avatar( get_the_author_meta( 'ID' ), 50) : '', in_array( 'author_link', $meta_elements ) ? '<span class="author-name">' . get_the_author() . '</span>' : '' ); $meta_list[] = '<small class="meta-author author vcard">' . $author . '</small>'; } if ( function_exists( 'bp_is_active' ) ) { if ( in_array( 'profile', $meta_elements ) ) { $author_links .= '<a href="' . bp_core_get_userlink( get_the_author_meta( 'ID' ), $no_anchor = false, $just_link = true ) . '">' . '<i class="icon-user-1 hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('View profile', 'kleo_framework'), get_the_author())) . '"' . 'data-toggle="tooltip"' . 'data-placement="top"></i>' . '</a>'; } if ( bp_is_active( 'messages' ) ) { if ( in_array( 'message', $meta_elements ) ) { $author_links .= '<a href="' . wp_nonce_url( bp_loggedin_user_domain() . bp_get_messages_slug() . '/compose/?r=' . bp_core_get_username( get_the_author_meta( 'ID' ) ) ) . '">' . '<i class="icon-mail hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('Contact %s', 'kleo_framework'), get_the_author())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a>'; } } } if ( in_array( 'archive', $meta_elements ) ) { $author_links .= '<a href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . '<i class="icon-docs hover-tip" ' . 'data-original-title="' . esc_attr(sprintf(__('View all posts by %s', 'kleo_framework'), get_the_author())) . '" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a>'; } } if ( $author_links != '' ) { $meta_list[] = '<small class="meta-links">' . $author_links . '</small>'; } if (in_array( 'date', $meta_elements ) ) { $meta_list[] = '<small>' . $date . '</small>'; } $cat_tag = array(); if ( isset( $categories_list ) && $categories_list ) { $cat_tag[] = $categories_list; } if ( isset( $tag_list ) && $tag_list ) { $cat_tag[] = $tag_list; } if (!empty($cat_tag)) { $meta_list[] = '<small class="meta-category">'.implode(", ",$cat_tag).'</small>'; } //comments if ((!isset($att['comments']) || (isset($att['comments']) && $att['comments'] !== false)) && in_array( 'comments', $meta_elements )) { $meta_list[] = '<small class="meta-comment-count"><a href="'. get_permalink().'#comments">'.get_comments_number() . ' <i class="icon-chat-1 hover-tip" ' . 'data-original-title="'.sprintf( _n( 'This article has one comment', 'This article has %1$s comments', get_comments_number(), 'kleo_framework' ),number_format_i18n( get_comments_number() ) ).'" ' . 'data-toggle="tooltip" ' . 'data-placement="top"></i>' . '</a></small>'; } $meta_separator = isset( $att['separator'] ) ? $att['separator'] : sq_option( 'blog_meta_sep', ', ') ; if ( $echo ) { echo implode( $meta_separator, $meta_list ); } else { return implode( $meta_separator, $meta_list ); } }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 14, 2016 at 18:17 #110408sharmstr
ModeratorIt doesnt work that way. You need to do separate functions for each taxonomy
COPY CODE$categories_list = get_the_term_list( $post->ID, 'portfolio-country', '', ', ' ); $categories_list .= get_the_term_list( $post->ID, 'portfolio-city', '', ', ' ); $categories_list .= get_the_term_list( $post->ID, 'portfolio-state', '', ', ' );
Again, it doesnt work that way…
COPY CODEif (get_post_type() == 'portfolio-audition' || get_post_type() == 'portfolio-job') {
Here is the WP codex on those functions
https://codex.wordpress.org/Function_Reference/get_the_term_list
https://developer.wordpress.org/reference/functions/get_post_type/Hope that helps
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 16, 2016 at 17:04 #110973clyn
ParticipantHi again,
Can you reply my last question above please, how can i seperate with ‘ – or . symbols between added taxonomy labels…. thanks
March 16, 2016 at 17:52 #110988sharmstr
ModeratorTry this
COPY CODE$categories_list = get_the_term_list( $post->ID, 'portfolio-country', '', ', ' ); $categories_list .= ' ,'; $categories_list .= get_the_term_list( $post->ID, 'portfolio-city', '', ', ' ); $categories_list .= ' ,'; $categories_list .= get_the_term_list( $post->ID, 'portfolio-state', '', ', ' );
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
April 14, 2016 at 14:35 #116559clyn
ParticipantRelated this topic, is any way to show membershiplevels on post layout?
thanks
April 14, 2016 at 16:35 #116595sharmstr
ModeratorPlease contact cornel@seventhqueen.com to get a quote on this.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
March 30, 2018 at 16:15 #193435clyn
ParticipantHi,
I start my project again, and this code is not working. I’m adding my chilt theme function php just changing cpt names and tax names but archive for cpt not show any posts and also wp default post dont show post contnet and meta tags. Maybe something change in kleo and this code is not working.
Thanks… -
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.