Hello,
I am a Pro theme user and am trying to launch a new blog/site. I recently installed the WP Reading Time plugin and am trying to add the shortcode for the plugin to my functions.php theme file. I’ve set up a child theme for Pro in order to edit the post meta that appears at the top of each blog post underneath the title. I’d only like to show publish date or last updated date (whichever is more recent) AND the reading time – I don’t want to show author, categories or comments. I used this guidance to show publish date OR last updated date, but could use help formatting the reading time properly.
I’ve updated my functions.php child theme to the following, but can’t figure out how to get the reading time to have the same format/styling (font size, uppercase, color as the publish & last updated date. I’d also like the reading time to show up on the same row as the publish or last updated date. I’m attaching a screenshot of how the post metadata currently looks on a test blog post.
Here is the code I’m currently using on the functions.php file. I don’t have anything input for the stylesheet and don’t know how to write CSS (or PHP), so any help would be greatly appreciated. Thanks!
<?php
// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
function x_integrity_entry_meta() {
//
// Date.
//
$original_time = get_the_time('U');
$modified_time = get_the_modified_time('U');
if ($modified_time >= $original_time + 86400) {
$date = sprintf( '<span>Last updated on <time class="entry-date" datetime="%1$s"> %2$s</time></span>',
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
} else {
$date = sprintf( '<span><time class="entry-date" datetime="%1$s"><i class="x-icon-calendar" data-x-icon=""></i> %2$s</time></span>',
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
}
//
// Output.
//
if ( x_does_not_need_entry_meta() ) {
return;
} else {
printf( '<p class="p-meta">%1$s%2$s%3$s%4$s</p>',
$author,
$date,
$categories_list,
$comments
);
}
echo do_shortcode( '[rt_reading_time label="" postfix="minute read" postfix_singular="minute read"]' );
}
// =============================================================================
// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
// 01. Enqueue Parent Stylesheet
// 02. Additional Functions
// =============================================================================
// Enqueue Parent Stylesheet
// =============================================================================
add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );
// Additional Functions
// =============================================================================
s