Wordpress Plugin Help - Moving from Main page to Single Page

Discussion in 'WordPress' started by duanehaas, Jan 2, 2010.

  1. #1
    I use a wordpress plugin called sharebuttons that places some social bookmarking buttons at the end of my content. I would like to forgo placing it in the main page of my site and only place it on individual pages. What hook or anything would I use to accomplish this? Or can I just hard code it into my single.php instead of using a plugin? Here is the code for the plugin...

    <?php
    /*
    Plugin Name: ShareButtons 
    Plugin URI: http://www.picturesurf.org/share-buttons
    Description: Add sharing buttons to your blog posts for: Facebook, Digg, Twitter, Email, Reddit, StumbleUpon, etc.
    			       Having large buttons for the top sharing sites results in a lot more sharing than a single-button that overwhelms users with lots of sharing options.
                 You can always change what buttons you want to appear.
    Version: 1.0.0
    Author: AlanEdge, ysterbal
    */
    /*
      Copyright 2008 Picturesurf.org
    
        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.
    
        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
    
        You should have received a copy of the GNU General Public License
        along with this program; if not, write to the Free Software
        Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    
    */
    add_filter('the_content', 'add_sharebuttons', 99999);
    function add_sharebuttons($content)
    	{
    		$tag_pattern = '/<div id="sharepost"/i';
    
    		if(!preg_match($tag_pattern,$content)) // Make sure we dont intefere with the plugins
    		{		
    			// Check for an existing copy of the text in the post
    			$title = the_title("","",false);
    			$url = get_permalink();						
    			
    			
    			$content .= __('<div id="sharepost" style="padding-top:10px;" ><a href="mailto:?subject=' . $title . '&amp;body=' . $url . '" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/mail.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    			
    
    $content .= __('<a href="http://www.facebook.com/share.php?u=' . $url . '" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/facebook.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    			
    
    $content .= __('<a href="http://twitter.com/home?status=' . $url . ' target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/twitter.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    			
    $content .= __('<a href="http://www.stumbleupon.com/submit?url=' . $url . '&amp;title=' . $title . '&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/stumbleupon.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    
    
    $content .= __('<a href="http://digg.com/submit?url=' . $url . '&amp;title=' . $title . '&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/digg.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    
    $content .= __('<a href="http://www.fark.com/cgi/farkit.pl?u=' . $url . '&h=' . $title . '&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/fark.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    
    $content .= __('<a href="http://www.reddit.com/submit?url=' . $url . '&amp;title=' . $title . '&amp;bodytext=&amp;media=&amp;topic=" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/reddit.png" width="60" height="60" alt="" /></a>&nbsp;&nbsp;');
    
    $content .= __('<a href="http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=' . $url . '&amp;title=' . $title .'" target="_blank"><img src="http://dailyfailblog.com/wp-content/plugins/sharebuttons/delicious.png" width="60" height="60" alt="" /></a></div>');
                            
       }
        
        return $content;
    	}		
    ?>
    PHP:
    Thanks for any help!
     
    duanehaas, Jan 2, 2010 IP
  2. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Give me a sec. Gotta go look something up.

    add_filter('the_content', 'add_sharebuttons', 99999);
     
    theapparatus, Jan 2, 2010 IP
  3. usmanobf

    usmanobf Active Member

    Messages:
    112
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    51
    #3
    Download a news plugin "sociable" and works as u want. it can display bookmarks on main pages or single post.
     
    usmanobf, Jan 5, 2010 IP
  4. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I am looking for same plugin @usman I'll check your plugin
     
    Polizel, Jan 5, 2010 IP
  5. Polizel

    Polizel Peon

    Messages:
    93
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I checked it but it is not showing up on homepage ! any settings required?
     
    Polizel, Jan 5, 2010 IP