Adding Social Media Icons On Certain Posts

social-mediaThere are many WordPress plugins out there that allow you to display various social media buttons on your posts making it very simple for your readers to share and submit your article to various social media websites.

While this is a great way to promote your blog posts, the buttons do not serve a purpose if you simply have an announcement to make on a post.

It would be great if we can turn the option on and off as needed, right?. Well by using WordPress’ custom fields and a little bit of PHP coding, we can display or not display these social media icons.

Let’s get to it

Step 1 – Download the SexyBookmarks plugin, upload it into your plugins folder and activate it.

Step 2 – Go into the plugin settings and modify the settings. You can reorder the icons by clicking and dragging. Check mark the ones you want to display.

social1

In the Placement option, select Manually Insert.

social2

Step 3 – Go into your Themes folder and find single.php. Open the file and locate The following code:

1
<?php the_title(); ?>

The above code displays the title of your blog post. If you want the social media icons to appear right above title, then copy the code below and place it before the title.

1
2
3
<?php if(get_post_meta($post->ID, "socialmedia", true)){ 
     if(function_exists('selfserv_sexy')) { selfserv_sexy(); }
} ?>

If you want the plugin to display at the bottom of your post, then paste the above code right after:

1
<?php the_content(); ?>

Step 4 – In the Admin panel, open up one of your posts or create a new one. Scroll down to the Custom Fields section, click Enter New, name it socialmedia and give it a value of 1 or yes or whatever value you prefer, it really doesn’t matter as long as you input a value in there. Click the Add Custom field button to save it. You should now see a custom field called social media with a value of 1 or whatever value you chose.

social3

From now on whenever you want to display your social media icons, simply scroll down to the Custom Fields section, click on the name drop-down, select socialmedia and give it any value.

social4

Related posts:

  1. Reverse The WordPress Comments From Newest To Oldest If you want to display your comment list from newest...
  2. How To Remove Categories From Your URL WordPress is my favorite blogging platform but it’s not perfect...

6 Comments for "Adding Social Media Icons On Certain Posts"

  1. Great post, i think blog posts like this add so much value to the marketing community,i have learnt some valuable info from you. Keep it Up! Sincerely, The Social Media Trainer

    Reply To This Comment

    Social Media Trainer   —   September 15, 2010
  2. I am really grateful that I determined this particular article. This’s just the advice I had been looking for.

    Reply To This Comment

    Austin Schweinsberg   —   July 6, 2010
  3. Sexy Bookmarks is the best Bookmarks plugin for wordpress, I use it for all of my sites. Thanks for showing how to add the buttons manually. Till now I only used the automatic option

    Reply To This Comment

    Forum Indonesia   —   January 7, 2010
  4. here is momething happened here

    Reply To This Comment

    aion power leveling   —   November 25, 2009
  5. Brilliant. Excellent. Amazing.. Now adding up all buttons.

    Reply To This Comment

    CI Web Studio MI   —   October 11, 2009
  6. Thanks! I’ve been looking for a way to turn these buttons off.

    Reply To This Comment

    godaddy.coupons   —   October 3, 2009

1 Trackbacks/Pingbacks

  1. Pingback: Posts about themes as of July 12, 2009 | All About WordPress on July 12, 2009

Leave a Reply





Featured Template

Connect With Me

Check out my about.me profile!

Latest Testimonial

"As the project began, Jon led me through process, and the final product is better than I could have imagined!" [ ...read more... ]

Shawna — 1/25/12