-
Author
-
July 23, 2015 at 14:32 #69627maelgaParticipant
Hi,
I am not using the “standard” layout to display custom post types (not the masonry layout).
Due to the small space constraints most author names takes 2 lines.
Instead of showing the full name, how can I display only the First Name and initial (first letter) of the last name?I’ve tried to edit my archive-customposttype.php to implement this
COPY CODE<?php echo the_author_meta('first_name'); ?> <?php echo (' '); ?> <?php echo substr(get_the_author_meta('last_name'),0,1).'.'; ?>
but the code is quite tricky calling for a specific class:
COPY CODE<?php //Specific class for post listing $blog_type = sq_option('blog_type','masonry'); $blog_type = apply_filters( 'kleo_blog_type', $blog_type ); $template_classes = $blog_type . '-listing'; if ( sq_option( 'blog_meta_status', 1 ) == 1 ) { $template_classes .= ' with-meta'; } else { $template_classes .= ' no-meta'; } if ( $blog_type == 'standard' && sq_option('blog_standard_meta', 'left' ) == 'inline' ) { $template_classes .= ' inline-meta'; } add_filter('kleo_main_template_classes', create_function('$cls','$cls .=" posts-listing ' . $template_classes . '"; return $cls;')); ?>
How can I change these author meta or implement my above snippet to display the last name’s initial only?
July 23, 2015 at 15:07 #69639sharmstrModeratorYou need to be changing the kleo_entry_meta function in /kleo/functions.php. Copy it to your child theme first. It uses get_the_author so you’ll need to change that.
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
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.