How to Add Facebook Like Button in WordPress

Facebook button is very useful and it help  you to grow website visitor. First open your single.php or post.php  file in your theme’s folder. Then paste the following code before or after the_content() inside your post loop:

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe>

If you want to show the friend icons under the button, then you should use the parameter:

show_face=true

If you want to display the simple button with only the count and nothing else, then you want to use the parameter:

layout=button_count

If you want a darker color scheme for your button, then you need to use the parameter:

colorscheme=dark

If you want to change the text from Like to Recommend, then use the parameter:

action=recommend

Best plugin collection for wordpress template developer

Akismet

Possibly the best way in the world to protect you from web spam.

All In One SEO Pack

Optimizes your WordPress blog for Search Engines.

Inline PHP

The plugin can execute php string in posts/pages, and display the output as the contents of posts/pages.

PHP Code Widget

The normal Text widget allows you to insert arbitrary Text and/or HTML code. This allows that too, but also parses any inserted PHP code and executes it.
Read more

Blank WordPress Theme

The main purpose of this Blank WordPress Theme  to make your WordPress theme development time shorter.

The main features of Blank WordPress Theme (version 1) are:

  • The sidebar is widget-ready.
  • Loads google hosted jQuery.
  • Registers the sidebar widget area.
  • Has CSS reset.
  • Theme option page.
  • Post Thumbnail support.
  • Lightweight only 15KB.

The new version 1.5 have the following features:

  • Register navigation menu
  • Better theme option panel

Read more

Create a css3 dropdown menu in wordpress

In this tutorial i will show you how to create a apple style css3 drop down menu in wordpress.Ok lets start, at  first i use this code to create navigation in wordpress.

Paste this code in your header.php


<div id="navigation" >
 <ul id="nav">
 <li><a href="<?php bloginfo('siteurl'); ?>">Home</a></li>
 <?php wp_list_pages('title_li=&sort_column=menu_order'); ?>
 </ul>
</div><!-- #navigation -->

Some jQuery required to show/hide the drop down menu’s.Paste this code before wp_head();

Read more

How to Create Recent Posts with Thumbnails in WordPress

There are some plugins for Recent post but i love the coding way.Just paste this code in your side bar.


<h3><?php _e( 'Recent Posts' ); ?></h3>

<?php
$the_query = new WP_Query('showposts=5&orderby=post_date&order=desc');
while ($the_query->have_posts()) : $the_query->the_post();
?>

<div class="latest_post">

<div class="image_holder" >
<?php the_post_thumbnail(array(50,50), array ('class' => 'alignleft')); ?>
</div><!--#image_holder-->

<div class="recent_description">
<h4><a title="<?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php echo get_the_date('m/d/y'); ?> - <?php the_title(); ?></a></h4>

<?php the_excerpt(); ?>

  </div><!--#recent_description-->
</div><!--#latest_post-->

<?php endwhile; ?>

<?php wp_reset_query(); ?>?

Read more

Add Adsence in your Thesis theme sidebar

This is a really easy to add Adsense into your Thesis blog sidebar without manually doing it or using a plugin.

Just put this code in your custom_functions.php

function adsence_code() {  ?>
<div id="adsence">
//your adsence code is here
</div>
<?php }

add_action('thesis_hook_after_multimedia_box', 'adsence_code');

Create a popular post widget without plugin

In one of my wordpress project i need to create a wordpress popular post widget.Now i am giving the code to you.This code will show a list of most commented  post  without using a plugin.See the php code below.

 <?php
 // POPULAR POST WIDGET
 class show_popular extends WP_Widget {

function show_popular() {
 $widget_ops = array('classname' => 'show_popular', 'description' => __('Show your popular posts.'));
 $this->WP_Widget('show_popular', __('Wpgreen - Popular Posts'), $widget_ops, $control_ops);
 }

function widget($args, $instance){
 extract($args);

//$options = get_option('custom_recent');
 $title = $instance['title'];
 $postscount = $instance['posts'];

//GET the posts
 global $postcount;

$myposts = get_posts(array('orderby' => 'comment_count','numberposts' =>$postscount));

echo $before_widget . $before_title . $title . $after_title;

//SHOW the posts
 foreach($myposts as $post){
 setup_postdata($post);

?>

<h4><?php the_title(); ?></h4>
 <p>
 <a href="<?php the_permalink() ?>"><?php echo  substr(strip_tags($post->post_content), 0, 80);  ?>...</a></p>
 <?php
 }
 echo $after_widget;
 }

function update($newInstance, $oldInstance){
 $instance = $oldInstance;
 $instance['title'] = strip_tags($newInstance['title']);
 $instance['posts'] = $newInstance['posts'];

return $instance;
 }

function form($instance){
 echo '<p style="text-align:right;"><label  for="'.$this->get_field_id('title').'">' . __('Title:') . '  <input style="width: 200px;" id="'.$this->get_field_id('title').'"  name="'.$this->get_field_name('title').'" type="text"  value="'.$instance['title'].'" /></label></p>';

echo '<p style="text-align:right;"><label  for="'.$this->get_field_id('posts').'">' . __('Number of Posts:',  'widgets') . ' <input style="width: 50px;"  id="'.$this->get_field_id('posts').'"  name="'.$this->get_field_name('posts').'" type="text"  value="'.$instance['posts'].'" /></label></p>';

echo '<input type="hidden" id="custom_recent" name="custom_recent" value="1" />';
 }
 }

add_action('widgets_init', create_function('', 'return register_widget("show_popular");'));
 ?>

Just copy the above code and paste it to the function.php of your theme file.If your theme doesn’t have function.php then create one.

After  placing the code in your theme.Please click on the widget tab and you will see your popular post widget.You can give custom title and number of post to display.

Happy hacking!