How to make rtSocial Plugin to appear only on the post?


#1

Hello,

Thanks for the rtSocial Plugin it looks great :slight_smile:

I installed the plugin and works great but it appears on homepage and on every post you can check it here www(dot)thedroidin(dot)in. It should appear only one the single post not on the homepage on every post, please help.

Thanks & Regards

Nikhil


#2

Hi inikhil,

You’re here in good time!

We’re actually implementing the feature to choose whether or not you want to display the social buttons on the archive pages and will be releasing it in the next update.

We’ll let you know as soon as we’re ready with it! :slight_smile:

Rutwick


#3

Thanks a lot for the reply and waiting for the update :slight_smile:


#4

Any update on this? This is the one feature that is preventing me from using/recommending your plugin.


#5

Yes, you can check the latest version of rtSocial (2.0.2). We have added over-ride option for manual code insertions by which you can add different social icons on homepage and other single pages.


#6

I am having rtsocial 2.1.2 and still i see no option to make this appear only on single posts and not on homepage, is there any solution to these?


#7

Hi Zenil,

Currently, the only way you can achieve this, is by adding the function manually, to the template files, using the manual mode.

This is shown on the options page. You just have to add that piece of code in your template file, wherever you want the social sharing to show up.

We do want to add such a setting, but there are too many combinations of post types and archives to take care of. It's easier to just paste the code for such fine grain control.

Regards.


#8

Hi, I really like this plugin, but I have a problem with where to put the code. I am using Weaver II theme, and I figure the proper place to put it, is in the single.php. I have tried different locations but nothing seem to happen. Any suggestion?

Regards Bjarne


#9

Hi @bjarnep,

Weaver works in a way that is almost the standard, but not quite there. This question ideally belongs to the Weaver support forum.

However, I don't see a reason why it shouldn't work. Could you also post a link to a post after you've tried pasting the code?

Regards.


#10

Hi again, Well, it's working - not the way I thought it would, but it does! My problem is now that I have the blog as frontpage, and the button will only show when I open the post. You can see it here: http://p-skakklub.dk So I'll have to work my way around somehow or accept buttons on all pages - too bad, this plugin is really great, fast and easy to use

Bjarne


#11

Hi,

You can also add it to the archives or any other template, in the same manner. The key is to inspect the html of a page generated via the template and then find the specific html tags in the theme's template and paste rtSocial's code there.

I hope that helps.

Best luck!


#12

Well thank you - I'll have to play detective then :-)

Bjarne


#13

Even with manual insert mode, it appears that rtSocial inserts CSS/Javascript content into all pages. I’ve come up with the following (which goes in functions.php) to remove all traces of rtSocial from non-blog post pages. I wanted to run it by the developers to see if it looks valid:

add_action('template_redirect', 'rtsocial_sweeper');  
function rtsocial_sweeper() {  
    // if not a blog post, remove all traces of rtSocial  
    if (!is_single()) {  
        remove_action('wp_enqueue_scripts', 'rtsocial_assets');  
        remove_action('wp_footer', 'rtsocial_ie_fix');  
        remove_action('wp_head','rtsocial_ajaxurl'); // remove 'Define AJAX URL'  
        remove_action('wp_ajax_rtsocial_gplus', 'rtsocial_gplus_handler');  
        remove_action('wp_ajax_nopriv_rtsocial_gplus', 'rtsocial_gplus_handler');  
        remove_filter('the_content', 'rtsocial_counter');  
        remove_filter('the_excerpt', 'rtsocial_counter');  
    }  
}

I just went through the plugin and located all references to actions and filters added, then wrote the above which basically reverses all rtSocial code insertions on pages that are not single blog posts.


#14

Hello there, I'd like to thank Vinity for the code he proposed. I just tried it here (with Twenty Twelve theme), and it seems to work perfect! Thx again!


#15

Sorry! I forgot to thank the team here at rtcamp for the great job they did. The plugin works fine and does not slow down the loading time. That's great. Thanks again.


#16

Great stuff vinity! I really enjoy the plugin, however, I've chosen to have the buttons display at the top of my posts and unfortunately the the first line of my posts wrap around the sharing options. I'd like to add BR code to space it out but not sure where to add it when I click "edit" on the plugin. Thanks


#17

Huge thanks too Vinity for the code. Despite always using the manual option, the social share icons always showed up in excerpts on category pages, etc. Now they are finally only showing where I want them. You’re a gem!


#18

@vinity
That’s great. Thank you for this addition. Would you be able to send this in a pull request here?

That way, we’d be able to add it to the code and credit you as a contributor.

Regards.


#19

Awesome. Thank you so much for this.


#20