Reader Feed Post Image, Follow Button & Frontend Display

3 quick questions re the Reader plugin...

1) I just added the php for generating the post image in the Reader Feed, as mentioned in this post ( https://premium.wpmudev.org/forums/topic/can-you-set-the-reader-so-that-featured-images-show-up ).

Here is the code:

<?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?>

However, it only works if the image is coming from that specific blog. If the image is coming from another MultiSite blog it does not show in the Reader feed.

How can we fix this?

2) What is the code for the Follow button?

Would like to use it in modals and widgets.

3) How can the Reader Feed be displayed in the frontend?

I'm asking this because I heard that having it in the backend is not resource sufficient.

From a server usage perspective, is it better to have it in the frontend?

Seems like frontend would be better from UX perspective.

What about posting content, should we use a frontend posting plugin as well?

We will probably have a couple hundred MultiSite blogs within the first few months, want to make sure we have a set up that will load quickly.

Any advice appreciated...

Thank you for your time.

  • Adam Czajczyk

    Hello David,

    I hope you're well today and thank you for your questions!

    1) I just added the php for generating the post image in the Reader Feed (...) However, it only works if the image is coming from that specific blog. If the image is coming from another MultiSite blog it does not show in the Reader feed.

    The "get_the_post_thumbnail()" function should work on Multisite pretty much the same way as it does on a single site. I understand that it's not showing images for posts from other sites but posts' content is shown properly, is that correct? Could you also please point me to a site(s) of yours where I could see this "live"?

    2) What is the code for the Follow button?
    Would like to use it in modals and widgets.

    The "Follow" button is added only to the user toolbar (on back-, front-end or both). However, the button itself is a simple link like this:

    http://yourdomain.com/wp-admin/index.php?page=msreader.php&module=follow&argsaction=follow&argsblog_id=1

    The significant part is the "1" parameter at the end of the URL. This should be replaced with an ID of the blog (site of Multisite) which you may fetch with WP function. As a result I think you could add a shortcode to your site and use it to put a "Follow" button anywhere:

    <?php
    function wpmu_reader_follow_shortcode($atts) {
    $blog_id = get_current_blog_id();
    $button = '<a href="http://yourdomain.com/wp-admin/index.php?page=msreader.php&module=follow&args[action]=follow&args[blog_id]='.$blog_id.'">FOLLOW</a>';
    return $button;
    }
    add_shortcode('follow-button','wpmu_reader_follow_shortcode');

    To apply it to your setup please create an empty file with a ".php" extension, put the code inside (don't forget to replace the "yourdomain.com" part with your real domain name) and upload the file to the "/wp-content/mu-plugins" folder on your server. You should then be able to use "[follow-button]" shortcode anywhere across the site.

    3) How can the Reader Feed be displayed in the frontend?

    It cannot be displayed on front-end in the same form as in back-end. There's however a widget called "Reader: Recent Posts" which you may use on front end and with a little bit of CSS styling this should do the job, I think.

    I'm asking this because I heard that having it in the backend is not resource sufficient.
    From a server usage perspective, is it better to have it in the frontend?
    Seems like frontend would be better from UX perspective.
    What about posting content, should we use a frontend posting plugin as well?

    I don't think putting reader on front would make any significant change to performance. I'd also avoid adding any front-end posting tools unless it suits your User Experience model. It's true that "keeping users away from dashboard" may be beneficial in terms of security but on the other hand a front-posting plugin is another "gateway" that can potentially become the target of malicious bots or of an attacker. I'd say then: the best would be to try to follow a "natural" WP workflow/standards as much as possible.

    I hope that helps!
    Best regards,
    Adam

  • David

    Adam,

    I sent you an email with the login info for the Reader Feed image issue.

    Thank you for the Follow button code! Just set it up and it works.

    Is there any code that I can add to it so it doesn't show when you are on a site that you already follow?

    Or maybe it would just say "following" as the admin bar says when you are on a site you already follow.

    As it works now, when you are on a site you already follow, and you click the "follow" shortcode, you are linked to the backend reader and it tells you are following the site.

    I really appreciate this code Adam, as it works now it is a HUGE help!

  • Milan

    Hello David

    Hope you are well today and thanks for update.

    I've notified Adam about your reply, He is not online currently. But he will get back to you over email as soon as possible. Please follow him up there so that he can assist you well. If there will be any need or replying here, he will post his reply here. otherwise email communication is good way to stick for now. :slight_smile:

    Cheers,
    Milan

  • Adam Czajczyk

    Hello David!

    I'm sorry for the delay on this one. I checked your site and confirmed that those images are still not handled properly on sub-pages although they does seem to work on a main site. I tried to access your server again to implement changes to the code I added there but wasn't able to. I assume that you already revoked an FTP access that you provided me with (which is good for security of course!) so could you please provide me with FTP access credentials one more time so I could review the code and "patch" it?

    Please contact me the same way you did previously (as subject line use "ATTN: Adam Czajczyk") and I'll be instantly notified of your message.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello David!

    Thanks for your kind words and I'm happy I could help.

    I'd just like to add one more important information to this that didn't include in my e-mail message. Some changes that I made were made to the plugin's core files ("content-post.php") so it would be better to backup that file as it is now in case an update was released. Any update would break those changes and you could then simply either re-upload the file or compare changes and apply them to an updated plugin. That's not vary likely to be necessary but it's better to take care of it "just in case" :slight_smile:

    Once again, thanks for your kind words!

    Have a nice day,
    Adam