- This topic has 11 replies, 2 voices, and was last updated 3 months, 2 weeks ago by
David.
-
AuthorPosts
-
April 28, 2022 at 5:19 am #2202678
Puneet
Hi
I am using Post meta as the image below.https://snipboard.io/cZ62oA.jpg
post link: https://manoftech.com/wordpress-com-review/
I just need to add reading time to it. I used the filter below given by Tom from another post.
`
-
function tu_estimated_reading_time() {
$post = get_post();
$content = $post->post_content;
$wpm = 300; // How many words per minute.$clean_content = strip_shortcodes( $content );
$clean_content = strip_tags( $clean_content );
$word_count = str_word_count( $clean_content );
$time = ceil( $word_count / $wpm );return $time . ‘ minutes’;
}add_filter( ‘generate_post_date_output’, function( $output ) {
$output .= ‘Reading time: ‘ . tu_estimated_reading_time() . ‘‘;
return $output;
} );The question is, how do I add reading time to the post meta designed using the dynamic option in elements via generateblocks?
Regards,
PuneetApril 28, 2022 at 5:27 am #2202684David
StaffCustomer SupportHi there,
see this topic – it provides the same thing but as a shortcode:
https://generatepress.com/forums/topic/how-to-move-an-element-below-a-certain-element/#post-2123998
Look for this line:
$time ='<div class="read-time"><span class="gp-icon">•</span>Reading time: '. ceil( $word_count / $wpm ) . ' minutes'. '</div>';
Change that to:
$time ='Reading time: '. ceil( $word_count / $wpm ) . ' minutes';
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 28, 2022 at 5:45 am #2202706Puneet
It’s showing with a shortcode, but how do I control the padding around it within generateblocks element. I would need a bit of padding on the left.
April 28, 2022 at 5:59 am #2202714David
StaffCustomer SupportAdd the shortcode inside of a GB Headline Block, the output from the shortcode will respect the headline blocks styles
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 28, 2022 at 6:07 am #2202718Puneet
Hi David,
Thanks again. It worked perfectly. Though I wonder why I couldn’t think of that…lol. I have a lot to learn clearly. Thanks a ton again.Regards,
PuneetApril 28, 2022 at 6:07 am #2202720David
StaffCustomer SupportGlad to be of help!
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 28, 2022 at 6:29 am #2202740Puneet
Oops,
Sorry, I forgot to ask another query. If I add social icons from the generateblocks template library, what URL do I add to them to make them social share icons and not follow buttons? We can use Facebook and Twitter as an example here. Thanks,Regards,
PuneetApril 28, 2022 at 6:35 am #2202748David
StaffCustomer SupportUnfortunately thats not possible. You would need to use a social sharing plugin for that.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 28, 2022 at 6:46 am #2202765Puneet
I am using a social sharing plugin. I was thinking of adding a custom button near the featured image or with the post meta. Something like this:-
https://snipboard.io/9j7g45.jpg
I can place the icons but don’t know how to use them as share buttons.
Regards,
PuneetApril 28, 2022 at 6:50 am #2202769David
StaffCustomer SupportThe Icons added by a GB Button or Headline block can only link to static URLs, they can’t be converted to social shares without hijacking them with some Javsascript which is out of our scope.
Just add your social share icons using the plugin shortcode – if need be i can help with some CSS to position them
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/April 28, 2022 at 6:52 am #2202771Puneet
Thanks David,
Probably get to it later. Thanks again,Regards,
PuneetApril 28, 2022 at 7:03 am #2202779David
StaffCustomer SupportYou’re welcome
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.