Smart Reading WP integrated to theme

Home Forums Pro Support Forum Blackoot Pro Blackoot Pro Support Smart Reading WP integrated to theme

Smart Reading WP integrated to theme

This topic contains 10 replies, has 2 voices, and was last updated by  Mathieu Sarrasin 3 days, 15 hours ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #20458
    Smart Reading WP integrated to theme

    Marjorie
    Participant

    Hello there,

    Hope you’re doing well.

    I’m coming back to you because I’d like to integrate a new button at the beginning of my long posts with a time estimation reading.

    I added an image for you to see where I’d like to place this button. (Well, next to my name (author’s name) when in reader mode and next to “Edit” when in admin mode : this second one is not an obligation as this estimation is for my readers and not for me 🙂 )

    If needed, the exact name of the plugin is : Reading Time WP
    https://wordpress.org/plugins/reading-time-wp/

    Thanks for your help.

    Attachments:
    You must be logged in to view attached files.
    #20464
    Reply to: Smart Reading WP integrated to theme

    Mathieu Sarrasin
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Hello,

    I just had a quick look at the plugin’s description and fortunately this shouldn’t be too complicated.

    If the plugin’s option to add it automatically at the beginning of the post is not satisfactory, you’ll need to create a child theme which will allow you to add the plugin’s code into the theme exactly where you want.

    (You *could* do this without creating a child theme but this is not recommended because your code will be erased during each future update!)

    You will want to edit single.php, so copy this file into your child theme and edit it.
    To add your plugin’s output after the “edit” link (that is after the author’s name for non-admins), you’ll want to add the code between these lines (line 92-95):

    /* Edit link (only for logged in users allowed to edit post) */
    edit_post_link(__('Edit', 'icefit'), '<span class="editlink"><i class="fa fa-pencil"></i>', '</span>');
    
    ?></div><?php // End metadata

    According to the plugin’s FAQ, the code should be something like this:

    /* Edit link (only for logged in users allowed to edit post) */
    edit_post_link(__('Edit', 'icefit'), '<span class="editlink"><i class="fa fa-pencil"></i>', '</span>');
    
    echo do_shortcode('[rt_reading_time label="Reading Time:" postfix="minutes"]');
    
    ?></div><?php // End metadata

    You can edit “reading time:” as desired and it should do the trick.

    I haven’t tried it myself, I just based these instructions on the plugin’s FAQ. Please let me know if it doesn’t work as expected or if you are confused at any point while creating a child theme or editing the file and I’ll make sure to help you further 🙂

    #20468
    Reply to: Smart Reading WP integrated to theme

    Marjorie
    Participant

    I’m not really at ease with creating a child theme but I will take some time to check what I can do, I guess it’s not that hard as it sounds.

    I’ll let you know if it worked!

    #20470
    Reply to: Smart Reading WP integrated to theme

    Marjorie
    Participant

    It seems like I followed all your instructions.

    It works but not as I expected.

    First I have a time estimation before my home grid which I don’t want. I’d like to have estimations only in my posts (only in one category to be specific)

    Then it didn’t take the apparence of a button, it is simply written down, see attached file.

    Did I miss something?

    Attachments:
    You must be logged in to view attached files.
    #20474
    Reply to: Smart Reading WP integrated to theme

    Mathieu Sarrasin
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Okay I just had a closer look (and tested it this time), and there are a couple of things:

    – The output you saw in your post (and on your homepage as well) are the ones that the plugin generates automatically.
    You will want to disable this from the plugin options. There are two checkboxes: “Insert Reading Time before content:” and “Insert Reading Time before excerpt:”. Uncheck both.

    – It seems like something didn’t work in your child theme since the time estimate should appear next to the metadata and have the same “button” look as the date and author.
    Also the code I got from the FAQ was incomplete: it was missing the “postfix_singular” argument.

    So the code to add in single.php between edit_post_link() and “end metadata” should be like so:

    echo do_shortcode('[rt_reading_time label="Temps de lecture:" postfix="minutes" postfix_singular="minute"]');

    I’m attaching a pre-made child theme with this custom code in case you cannot get yours to work properly (you can upload/install/activate from Appearance > Themes > Add new > upload it just like a new theme).

    – Bonus: how about a little clock icon next to the estimate? (just like the calendar and person icon next to the date and author)
    Add this to Appearance > Theme Options > Code & CSS > Custom CSS:

    .span-reading-time:before {
        font-family: fontawesome;
        content: "\f017";
        color: #b7b7b7;
        padding: 0 5px;
    }
    
    .span-reading-time:hover:before {
        color: #000;
    }

    If you don’t want the icon, just add this instead to fix the spacing:

    .span-reading-time { padding-left: 5px; }

    Attachments:
    You must be logged in to view attached files.
    #20476
    Reply to: Smart Reading WP integrated to theme

    Marjorie
    Participant

    You’re the best!

    I installed the child-theme. The plugin works but the icon clock (it’s a great idea) is missing as you can see in attached file.

    For a reason I don’t know I lost my two sidebars. I guess it’s because my plugins are installed to the parent theme, right? But I ignore how to resolve the problem.

    Attachments:
    You must be logged in to view attached files.
    #20478
    Reply to: Smart Reading WP integrated to theme

    Mathieu Sarrasin
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Oh that’s my bad for the clock icon: please try to remove this code from Custom CSS and paste it at the end of the child theme’s style.css file (you can edit it from Appearance > Editor).

    This is because of the line content: “\f017” in the code (this is the code for the actual clock icon in font-awesome). This doesn’t aways play well in the Custom CSS field. It should work as expected if you add it directly in the style.css file.

    For the sidebars, this is an annoying side effect of switching themes (even switching from one theme a child): WordPress considers that your sidebars are only meant for the theme that was active when you created them.

    However, your widgets with all of their settings are not lost, fortunately!

    Once you activate the child theme, go to Appearance > Widgets, and you’ll find your widgets at the bottom left, in the “inactive widgets” section.
    You’ll just need to send them back to the sidebars where they should be!

    #20479
    Reply to: Smart Reading WP integrated to theme

    Marjorie
    Participant

    Hehe cool my sidebars are back. Thanks.

    I moved the code to the end of the style.css file, the icon is still missing but the code doesn’t appear anymore.

    Another point and I’ll be done for today. For the moment I have a plugin to display related articles at the end of my posts but I’d like to integrate it in a new footerbar that could be seen at the end of the post. I imagine this would make the end of posts as clean as I want.

    I also wanted to try another footerbar to integrate some more content (so maybe after the related articles and before the footer which already exists, or maybe at the top of the post grid) I know that in the theme options you can name any new sidebar. I did and i saw my new sidebar appear in the widget area but it never appears on the site when I publish it. Any idea?

    Thanks again for your precious help.

    #20480
    Reply to: Smart Reading WP integrated to theme

    Mathieu Sarrasin
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    I can see the icon now on your site! Make sure to refresh the page (ctrl+shift+R / cmd+shift+R to force a complete refresh) and you should see it too 🙂

    The additional sidebars you can create from theme options will not be displayed in addition to the current one: they may only replace the current one on some page (so you can have different sidebars for different pages if you don’t want to display the same widgets everywhere). For each page, you can select which sidebar to use from “icefit page settings” on the right side of the editor.

    So if you want your footer bar to be a sort of widgetized area at the bottom of your posts, then you’ll need a plugin for this. Unfortunately there isn’t one I can recommend, but I’m pretty sure you can find one that will do a decent job.

    #20482
    Reply to: Smart Reading WP integrated to theme

    Marjorie
    Participant

    Well, I refreshed and checked a few more times on different devices and I can’t see the icon anywhere :/ For the moment I deleted the code icon even if I find it would be cool to display it.

    All the plugins I found only replace the actual sidebar, I keep looking for the good one.

    Thanks!

    #20483
    Reply to: Smart Reading WP integrated to theme

    Mathieu Sarrasin
    Keymaster
    Support
    Happy with my help?
    Buy me a beer!

    Sounds like refreshing wasn’t enough for your browser, you may need to clear the cache or try with another browser or computer (or just give it some time since the cache will expire by itself after a short period). The code was working fine though since I could see the icon on your site from here!

    Here’s a plugin I found that seems to match what you are looking for https://wordpress.org/plugins/add-widget-after-content/ (this is just the result from a quick search, I haven’t tried it yet and there may be others!)

Viewing 11 posts - 1 through 11 (of 11 total)

Only logged-in users with a valid license for Blackoot Pro may post in this forum.

You must be logged in to reply to this topic.