Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1448636

    Hi,
    is there a way to place this shortcode on my blog-entries: [rt_reading_time label=”Lesedauer:” postfix=”Minuten” postfix_singular=”minute”] ? I would like to display the reading time when an article is hovered. It should be on the bottom right corner.

    Best regards

    #1448719

    Hey northorie,
    Thank you for the link to your site, it looks like you are using the masonry element and I believe that your shortcode is for the Reading Time WP plugin. I tested this on my demo site and found that adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function add_reading_time_to_masonry_entry($content, $entry, $config) {
        $reading_time_html = "<div class='reading-time'>" . do_shortcode('[rt_reading_time post_id="' . $entry['ID'] . '" label="Reading Time:" postfix="minutes" postfix_singular="minute"]') . "</div>";
        $content .= $reading_time_html;
        return $content;
    }
    add_filter('avf_masonry_entry_content', 'add_reading_time_to_masonry_entry', 10, 3);
    

    Please ensure to copy the code from the forum and not an email notification so the symbols are not converted.
    and adding this CSS in your Enfold Theme Options ▸ General Styling ▸ Quick CSS field:

    .av-inner-masonry .reading-time {
    	opacity: 0;
    	bottom: 0;
      position: absolute;
      right: 0;
    }
    .av-inner-masonry:hover .reading-time {
    	opacity: 1;
    }

    will add the reading time at the bottom right corner on hover only, like this:
    Enfold Support 6055

    Best regards,
    Mike

    #1448787

    Hi,
    thank you!
    It’s not working for me. What did I do wrong?

    Can I have it also without hovering. It want to see, what looks better :)

    #1448812

    Hi,
    Did you copy the code from the forum and not an email notification so the symbols were not converted?
    Please include an admin login in the Private Content area so we can check.

    Best regards,
    Mike

    #1449057

    Hi, yes I did.
    Admin-Login on Private content.

    Best regards

    #1449078

    Hi,
    Thank you for the link to your site, but the login is not admin so I can not see any of the theme settings or the custom code that you added, please check.

    Best regards,
    Mike

    #1449418

    Oh sorry, changed it to admin.

    best regards!

    #1450040

    Hi,

    Thank you for the update.

    The excerpt is currently disabled, but it needs to be enabled for the above modification to work. We adjusted the filter so that the reading time appears after the title instead of after the content. Please check it again. The reading time should display on hover.

    Best regards,
    Ismael

    #1451375

    Hi Ismael,
    thank you. Reading time is displayed but doesn’t look good, because the font is way too big. Can the font only for reading time in the headline be decreased?

    Best regards!

    #1451379

    Hi,
    Try this CSS in your Enfold Theme Options ▸ General Styling ▸ Quick CSS field:

    #top #wrap_all .all_colors h3 .span-reading-time {
    	font-size: 12px;
    }

    and adjust the font size to suit.
    After applying the css, please clear your browser cache and check.

    Best regards,
    Mike

    #1451384

    Way better :) Thank you!
    Can I have “Lesedauer” instead of “Reading Time”? And an additional break between the headline and the reading time? An “min.” instead of “minutes”?

    Best regards!

    • This reply was modified 5 months, 1 week ago by northorie.
    #1451397

    Hi,
    I notice that you are not using a child theme and have your customization in the parent theme functions.php
    all of these customizations will be lost the next time that you update the theme.
    If you are not going to use a child theme you could use the WP Code plugin then add a new snippet, in the top right corner use the PHP snippet as the code type:
    use wpcode php snippet and activate
    and ensure that it is activated, then save.
    I recommend that you move your customizations so you don’t lose them.
    I changed your Reading time code to this for your last requests:

    function add_reading_time_to_masonry_entry($content, $entry, $config) {
        $reading_time_html = "<div class='reading-time'></br>" . do_shortcode('[rt_reading_time post_id="' . $entry['ID'] . '" label="Lesedauer:" postfix="min" postfix_singular="min"]') . "</div>";
        $content .= $reading_time_html;
        return $content;
    }
    add_filter('avf_masonry_entry_title', 'add_reading_time_to_masonry_entry', 10, 3);

    Best regards,
    Mike

    #1451621

    Thank you too much, mike :)
    I’m really happy with my site now and will look for this plugin you suggested.
    Topic can be closed.

    Best regards!

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Reading time on blog page’ is closed to new replies.