wordpress 3.0 documentation for wordpress developers

We all know wordpress 3.0 beta is out and wordpress 3.0 will be out in May 2010. You can find the list of many of the enhancements and fixes.

wordpress 3.0 documentation for wordpress developers

wordpress 3.0 documentation for wordpress developers
wordpress 3.0 documentation for wordpress developers

All wordpress developers are looking for wordpress 3.0 documentation for development.

The WordPress 3.0 Codex is very good place to start working on wordpress 3.0

http://codex.wordpress.org/Version_3.0

Here I am giving the list of major changes of wordpress 3.0

* New menu management feature
* Improved custom post types (try the Custom Post Type UI plugin to see the possibilities)
* Improved custom taxonomies including hierarchical (category-style) support (again, try the Custom Post Type UI plugin to see the possibilities)
* New theme “Twenty Ten” is the only theme in the WordPress distribution, and is now designated the ‘fallback’ theme
* Improved child theme support; child theme use is highly encouraged and as described in the Child Themes article, very simple to accomplish
* The Default (Kubrick), and Classic themes, are no longer included in the WordPress distribution, but are available in the Theme repository
* Bulk theme update ability
* Standalone WordPress and WPMU code merged (Note: extra domain stuff remains plugin territory for this version)
* Configure a Network (multisite/WPMU) using wp-config.php file

how to add thank you message after wordpress comments

Saying thank you is always good manners. In article, i have code for, add thank you message after wordpress comments after adding comments added by users. I got the same request from many of clients for adding the thank you message after putting comments after by the user who comes to site.

It was good to have this functionality. User will remember your site and you should send the thank you email to user for adding the comment to your wordpress website. For professional sites, it is very great functionality.

add thank you message after wordpress comments

In this article I will show how to add custom message after getting comments from users. For this we going use the wordpress api. WordPress filters are very useful. You can find all wordpress hooks and filters in wp-includes/default-filters.php file.

  • Method First
add_filter('comment_post_redirect', 'redirect_after_comment');
function redirect_after_comment($location){
    $newurl = substr($location, 0, strpos($location, "#comment"));
    return $newurl . '?c=y';
}

if($_GET[ 'c' ] == 'y'){
      echo 'Thank you your comemnt';
} 

Open your functions.php file from your active wordpress theme folder. copy paste the following code in that file. This is very simple trick but still it is really useful.

  • Method Second

For this method you need to create the “Thank you” page in wordpress site than open functions.php file and put following code in that file.


// Redirect to thank you post after comment
add_action('comment_post_redirect', 'redirect_to_thank_page');

function redirect_to_thank_page() {
return 'https://purabtech.in/thank-you';
}

Note: do not forget to change your URL thank you URL from code.  Above code will work in new wordpress versions.

 

 

add thank you message after wordpress comments
add thank you message after wordpress comments

how to add a favicon to your wordpress site

In this tutorial we will show, how to add a favicon to your wordpress site, If you want to add the favicon image in your wordpress website that is really easy.

First use any photo editing tool like photoshop or gimp for creating the favicon image.

how to add a favicon to your wordpress site

how to add a favicon to your wordpress site
how to add a favicon to your wordpress site

To create the favicon image you should follow following rules

  1. By cropping or adding space around the image, make the image square.
  2. Resize the image to 16 x 16 pixels.
  3. Save the file as favicon.ico

Open your active wordpress theme and put favicon.ico image file in that folder or using ftp client you can put favicon.ico file in theme folder. After coping the favicon image file in theme folder. Open your header.php file from wordpress theme folder. and Put following code in that file.

 

 <link rel="shortcut icon" href="<?php bloginfo('template_directory'); ?>/favicon.ico" type="image/x-icon" />

Dont forget to put above code under head tag. Now your are set and changed the favicon from your wordpress site. To see the new favicon image you should clear your browser cache.

 

change background for specific page and category in wordpress

WordPress tutorial, We will show how to change background for specific page and category in wordpress theme. achieve using conditional tags.

change background for specific page and category in wordpress

Many times clients demands for different background color or different images as a background. We can very easily achieve this using wordpress conditional tags.

change background for specific page and category in wordpress
change background for specific page and category in wordpress

You can use following code in your page.php or category.php file which is present in wordpress theme. If you want to change the background for specific page then open page.php file from theme folder.


<body <?php if(is_page('contact us'))&nbsp; echo 'class="contact_us"';?>>

Use following css code in your style.css file


.contact_us{

.background-color:#ccc;

}

.php_category{

.background-color:#181818;

}

If you want to use different background for your category then use following code.



<body <?php if(is_category('php''))&nbsp; echo  'class="php_category"';?>>

How to add ads end of wordpress RSS feed

If you want place ads in RSS feed at end. that is very easy with wordpress websites. We given simple code, Using our code, add ads end of wordpress RSS feed.

How to add ads end of wordpress RSS feed

How to add ads end of wordpress RSS feed
How to add ads end of wordpress RSS feed

Open your functions.php file from wordpress theme folder and use following code:

function insertAds_in_rss($content) {

$content = $content.' Your ads code goes will here';

return $content;}

add_filter('the_content_feed', 'insertAds_in_rss');

add_filter('the_excerpt_rss', 'insertAds_in_rss');

how to create wordpress theme from scratch

many people written about creating wordpress theme and using wordpress hooks. Here in this tutorial I will show How to create wordpress theme from scratch.

create wordpress theme from scratch

Here in this tutorial I will show How to create wordpress theme from scratch. I given very detailed steps to create wp theme. You can create wp theme from simple jpg file or PSD file. First choose or create your html template from photoshop. For creating the html template you can refer following screen shots for creating photoshop image. This is very common layout for creating any webpage.

 

create wordpress theme from scratch
create wordpress theme from scratch

Here for this tutorial I am using following image for creating the wordpress theme.

create wordpress theme from scratch
create wordpress theme from scratch

After creating image in photoshop you need to create the html according to this image. Here I created the one index.html file and style.css file.
You can download the HTML from here:

wp-bluemagic-html

Now we can start creating the wordpress theme.
First create style.css file and in top section copy paste the following code:

/*
Theme Name: wp-bluemagic
Theme URI: purabtech.in/files/
Description: two column, blue color wordpress theme
Author: wordpressapi
Author URI: purabtech.in/files/
Version: 1.0

*/

You can change the information as per your requirement.

For creating the wordpress theme following minimum files are needed in wordpress theme folder.
1.    index.php
2.    header.php
3.    footer.php
4.    sidebar.php
5.    comments.php
6.    functions.php – not necessary
7.    screenshot.png

Here is my html code from index.html file rename that file to base.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Wordpressapi.com - wp-bluemagic</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<div id="wrapper">
 <div id="header">
 <div id="logo">
 <h1><a href="#">wp-bluemagic   </a></h1>

 </div>
 </div>
 <!-- header end -->
 <div id="menu">
 <ul>
 <li><a href="#">Home</a></li>
 <li><a href="#">Blog</a></li>
 <li><a href="#">Photos</a></li>
 <li><a href="#">About</a></li>
 <li><a href="#">Links</a></li>
 <li><a href="#">Contact</a></li>
 </ul>
 </div>
 <!-- menu end-->
 <div id="page">
 <div id="page-bgtop">
 <div id="page-bgbtm">
 <div id="content">
 <div>
 <h2><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</a></h2>
 <p><span>September 10, 2009</span><span>Posted by <a href="#">wordpressapi</a></span></p>
 <div style="clear: both;">&nbsp;</div>
 <div>
 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
 <p><a href="#">Read More</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Comments</a></p>
 </div>
 </div>
 <div>
 <h2><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</a></h2>
 <p><span>September 10, 2009</span><span>Posted by <a href="#">wordpressapi</a></span></p>
 <div style="clear: both;">&nbsp;</div>
 <div>
 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
 <p><a href="#">Read More</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Comments</a></p>
 </div>
 </div>
 <div>
 <h2><a href="#">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</a></h2>
 <p><span>September 10, 2009</span><span>Posted by <a href="#">wordpressapi</a></span></p>
 <div style="clear: both;">&nbsp;</div>
 <div>
 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum..</p>
 <p><a href="#">Read More</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="#">Comments</a></p>
 </div>
 </div>
 <div style="clear: both;">&nbsp;</div>
 </div>
 <!--content end-->
 <div id="sidebar">
 <ul>
 <li>
 <h2>Author Information</h2>
 <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
 </li>
 <li>
 <h2>Categories</h2>
 <ul>
 <li><a href="#">wordpress </a></li>
 <li><a href="#">wordpress theme</a></li>
 <li><a href="#">wordpress plugins</a></li>
 <li><a href="#">wordpress tips</a></li>
 <li><a href="#">wordpress hacks</a></li>
 <li><a href="#">wordpressapi</a></li>
 <li><a href="#">wordpress tutorials</a></li>
 </ul>
 </li>
 <li>
 <h2>Blogroll</h2>
 <ul>
 <li><a href="#">wordpress.com</a></li>
 <li><a href="#">wordpress.org</a></li>
 <li><a href="#">purabtech.in/files/</a></li>
 <li><a href="#">google.com</a></li>
 <li><a href="#">yahoo.com</a></li>
 <li><a href="#">live.com</a></li>
 <li><a href="#">facebook.com</a></li>
 </ul>
 </li>
 <li>
 <h2>Archives</h2>
 <ul>
 <li><a href="#">march 2010</a></li>
 <li><a href="#">feb 2010</a></li>
 <li><a href="#">january 2009</a></li>
 <li><a href="#">december 2009</a></li>
 <li><a href="#">november 2009</a></li>
 <li><a href="#">september 2009</a></li>
 <li><a href="#">july 2009</a></li>
 </ul>
 </li>
 </ul>
 </div>
 <!-- end #sidebar -->
 <div style="clear: both;">&nbsp;</div>
 </div>
 </div>
 </div>
 <!-- end #page -->
</div>
 <div id="footer">
 <p>Copyright (c) 2010 purabtech.in/files/. All rights reserved. Design and Developed by <a href="http://www.wordpressapi.org/">wordpressapi themes</a>.</p>
 </div>
 <!-- end #footer -->
</body>
</html>

Now we are going start to create the wordpress theme from html file which we created earlier.

First create the header.php file and copy paste the following code in that file. I taken the top header HTML code from base.html file.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="all" />
<?php wp_head(); ?>
</head>
<body>
<div id="wrapper">
 <div id="header">
 <div id="logo">
 <h1><a href="<?php bloginfo('siteurl');?>/"><?php bloginfo('name');?> </a></h1>
 </div>
 </div>
 <!-- header end -->
 <div id="menu">
 <ul>
 <licurrent_page_item";}?>" ><a href="<?php echo get_settings('home'); ?>">Home</a></li>
 <?php wp_list_pages('title_li=&depth=4&sort_column=menu_order&exclude=827'); ?>
 </ul>
 </div>
 <!-- menu end-->
<!-- end header -->

Create the index.php file and copy paste the following code in that file. I taken the middle or inner part of  HTML code from base.html file.

<?php get_header(); ?>
<div id="page">
 <div id="page-bgtop">
 <div id="page-bgbtm">
 <div id="content">
 <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 <div>
 <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
 <p><span><?php the_time('F - j - Y'); ?></span><span>Posted by <a href="<?php the_author_link(); ?>"><?php the_author(); ?></a></span></p>
 <div style="clear: both;">&nbsp;</div>
 <div>
 <p><?php the_content(); ?></p>
 <p><a href="<?php the_permalink(); ?>">Read More</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<?php comments_popup_link('COMMENTS', '1 COMMENT', '% COMMENTS'); ?></p>
 </div>
 </div>
 <?php comments_template(); // Get wp-comments.php template ?>
 <?php endwhile; else: ?>
 <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
 <?php endif; ?>
<?php posts_nav_link(' — ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
 <div style="clear: both;">&nbsp;</div>
 </div>
 <!--content end-->
 <?php get_sidebar(); ?>
 <div style="clear: both;">&nbsp;</div>
 </div>
 </div>
 </div>
 <!-- end #page -->
<?php get_footer(); ?>

Create the footer.php file and copy paste the following code in that file. I taken the bottom footer HTML code from base.html file.

</div>
 <div id="footer">
 <p>Copyright (c) 2010 purabtech.in/files/. All rights reserved. Design and Developed by <a href="http://www.wordpressapi.org/">wordpressapi themes</a>.</p>
 </div>
 <!-- end #footer -->
<?php wp_footer(); ?>
</body>
</html>

Create the sidebar.php file and copy paste the following code in that file. I taken the only the sidebar HTML code from base.html file. I taken only sidebar div from html and li tags and other widgets will be provided by wordpress admin, so you dont worry about that part.

<div id="sidebar">
<ul>
<?php     /* Widgetized sidebar, if you have the plugin installed. */
 if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<?php endif; ?>
</ul>
</div>
<!-- end sidebar -->

Create the comments.php file and copy paste the following code in that file. I did not taken HTML code or php from base.html file. This is common wordpress comments template. If you are designer then you dont need to worry about comments code. you just need to copy paste the following code into comments.php file

<?php

if ( post_password_required() ) : ?>
<p><?php _e('Enter your password to view comments.'); ?></p>
<?php return; endif; ?>

<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
<?php if ( comments_open() ) : ?>
 <a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
<?php endif; ?>
</h2>

<?php if ( have_comments() ) : ?>
<ol id="commentlist">

<?php foreach ($comments as $comment) : ?>
 <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
 <?php echo get_avatar( $comment, 32 ); ?>
 <?php comment_text() ?>
 <p><cite><?php comment_type(_x('Comment', 'noun'), __('Trackback'), __('Pingback')); ?> <?php _e('by'); ?> <?php comment_author_link() ?> — <?php comment_date() ?> @ <a href="#comment-<?php comment_ID() ?>"><?php comment_time() ?></a></cite> <?php edit_comment_link(__("Edit This"), ' |'); ?></p>
 </li>

<?php endforeach; ?>

</ol>

<?php else : // If there are no comments yet ?>
 <p><?php _e('No comments yet.'); ?></p>
<?php endif; ?>

<p><?php post_comments_feed_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
<?php if ( pings_open() ) : ?>
 <a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a>
<?php endif; ?>
</p>

<?php if ( comments_open() ) : ?>
<h2 id="postcomment"><?php _e('Leave a comment'); ?></h2>

<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.'), wp_login_url( get_permalink() ) );?></p>
<?php else : ?>

<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

<?php if ( is_user_logged_in() ) : ?>

<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>

<?php else : ?>

<p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
<label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>

<p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
<label for="email"><small><?php _e('Mail (will not be published)');?> <?php if ($req) _e('(required)'); ?></small></label></p>

<p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
<label for="url"><small><?php _e('Website'); ?></small></label></p>

<?php endif; ?>

<!--<p><small><strong>XHTML:</strong> <?php printf(__('You can use these tags: %s'), allowed_tags()); ?></small></p>-->

<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>

<p><input name="submit" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
</p>
<?php do_action('comment_form', $post->ID); ?>

</form>

<?php endif; // If registration required and not logged in ?>

<?php else : // Comments are closed ?>
<p><?php _e('Sorry, the comment form is closed at this time.'); ?></p>
<?php endif; ?>

Create the functions.php file and copy paste the following code in that file. In this file we are just registering the sidebar widgets, using following function.

<?php
automatic_feed_links();

if ( function_exists('register_sidebar') )
 register_sidebar();

?>

Here is my style.css file. You can create this file as per your theme. We are using the same css which we created for base.html, We just added some of extra code for wordpress theme and img alignment.

/*
Theme Name: wp-bluemagic
Theme URI: purabtech.in/files/
Description: two column, blue color wordpress theme
Author: wordpressapi
Author URI: purabtech.in/files/
Version: 1.0

*/

body {
 margin: 0;
 padding: 0;
 background: #FFFFFF;
 font-family: Arial, Helvetica, sans-serif;
 font-size: 12px;
 color: #787878;
}

h1, h2, h3 {
 margin: 0;
 padding: 0;
 font-weight: normal;
 color: #32639A;
}

h1 {
 font-size: 2em;
}

h2 {
 font-size: 2.4em;
}

h3 {
 font-size: 1.6em;
}

p, ul, ol {
 margin-top: 0;
 line-height: 180%;
}

ul, ol {
}

a {
 text-decoration: none;
 color: #4486C7;
}

a:hover {
}

#wrapper {
 width: 960px;
 margin: 0 auto;
 padding: 0;
}

/* Header */

#header {
 width: 940px;
 height: 148px;
 margin: 0 auto;
 background: #4169E1;
}

/* Logo */

#logo {
 float: left;
 margin: 0;
 padding-top: 30px;
 color: #000000;
}

#logo h1, #logo p {
 margin: 0;
 padding: 0;
}

#logo h1 {
 float: left;
 padding-left: 80px;
 letter-spacing: -1px;
 text-transform: lowercase;
 font-size: 3.8em;
}

#logo p {
 float: left;
 margin: 0;
 padding: 26px 0 0 10px;
 font: normal 14px Georgia, "Times New Roman", Times, serif;
 font-style: italic;
 color: #FFFFFF;
}

#logo a {
 border: none;
 background: none;
 text-decoration: none;
 color: #FFFFFF;
}
/*img align*/
img.centered  {
 display: block;
 margin-left: auto;
 margin-right: auto;
 margin-bottom: 10px;
 padding: 0px;
 }

img.alignnone {
 padding: 5px 5px;
 margin: 0px 0px 10px 0px;
 display: inline;
 background:#E3E8E0;
 border: 1px solid #C7CFC2;
 }

img.alignright {
 padding: 5px 5px;
 margin: 5px 0px 5px 5px;
 display: inline;
 background:#E3E8E0;
border: 1px solid #C7CFC2;
 }

img.alignleft {
 padding: 5px 5px;
 margin: 5px 5px 5px 0px;
 display: inline;
 background:#E3E8E0;
border: 1px solid #C7CFC2;
 }

.aligncenter {
 display: block;
 margin-left: auto;
 margin-right: auto;
 margin-bottom: 10px;
 }

.alignright {
 float: right;
 margin: 0px 0px 10px 10px;
 }

.alignleft {
 float: left;
 margin: 0px 10px 10px 0px;
 }

.wp-caption {
 border: 1px solid #C7CFC2;
 text-align: center;
 background-color: #E3E8E0;
 padding: 4px 0px 5px 0px;
 color:#222;
 }

.wp-caption img {
 margin: 0px 0px 5px 0px;
 padding: 0px;
 border: 0px;

 }

.wp-caption p.wp-caption-text {
 margin: 0px;
 padding: 0px 0px 0px 0px;
 font-size: 11px;
 font-weight: normal;
 line-height: 12px;
 }

/* Search */

#search {
 float: right;
 width: 280px;
 height: 60px;
 padding: 20px 0px 0px 0px;
 background: #4169E1;
 border-bottom: 4px solid #FFFFFF;
}

#search form {
 height: 41px;
 margin: 0;
 padding: 10px 0 0 20px;
}

#search fieldset {
 margin: 0;
 padding: 0;
 border: none;
}

#search-text {
 width: 170px;
 padding: 6px 5px 2px 5px;
 border: none;
 background: #FFFFFF;
 text-transform: lowercase;
 font: normal 11px Arial, Helvetica, sans-serif;
 color: #5D781D;
}

#search-submit {
 width: 50px;
 height: 23px;
 border: 1px solid #89B056;
 background: none;
 font-weight: bold;
 font-size: 10px;
 color: #FFFFFF;
}

/* Menu */

#menu {
 width: 940px;
 height: 49px;
 margin: 0 auto;
 padding: 0;
 background:#4169E1;
}

#menu ul {
 margin: 0;
 padding: 0;
 list-style: none;
 line-height: normal;
}

#menu li {
 float: left;
}

#menu a {
 display: block;
 width: 155px;
 height: 33px;
 padding-top: 16px;
 text-decoration: none;
 text-align: center;
 font-family: Arial, Helvetica, sans-serif;
 font-size: 13px;
 font-weight: bold;
 color: #FFFFFF;
 border: none;
}

#menu a:hover, #menu .current_page_item a {
 background: #659CEF;
 text-decoration: none;
}

#menu .current_page_item a {
 background: #FBFBFC;
 padding-left: 0;
 color: #30476A;
}

/* Page */

#page {
 width: 940px;
 margin: 0 auto;
 padding: 0;
}

#page-bgtop {
 padding: 20px px;
}

#page-bgbtm {
}

/* Content */

#content {
 float: left;
 width: 620px;
 padding: 30px 0px 0px 0px;
}

.post {
 margin-bottom: 15px;
}

.post-bgtop {
}

.post-bgbtm {
}

.post .title {
 margin-bottom: 10px;
 padding: 12px 0 0 0px;
 letter-spacing: -.5px;
 color: #000000;
}

.post .title a {
 color: #32639A;
 border: none;
}

.post .meta {
 height: 30px;
 background: #D8E7FE;
 margin: 0px;
 padding: 0px 0px 0px 0px;
 text-align: left;
 font-family: Arial, Helvetica, sans-serif;
 font-size: 13px;
 font-weight: bold;
}

.post .meta .date {
 float: left;
 height: 24px;
 padding: 3px 15px;
 color: #4A81DE;
}

.post .meta .posted {
 float: right;
 height: 24px;
 padding: 3px 15px;
 background: #4169E1;
 color: #FFFFFF;
}

.post .meta a {
 color: #FFFFFF;
}

.post .entry {
 padding: 0px 0px 20px 0px;
 padding-bottom: 20px;
 text-align: justify;
}

.links {
 padding-top: 20px;
 font-size: 12px;
 font-weight: bold;
}

/* Sidebar */

#sidebar {
 float: right;
 width: 280px;
 padding: 0px;
 color: #787878;
 background: #FFFFFF;
}

#sidebar ul {
 margin: 0;
 padding: 0;
 list-style: none;
}

#sidebar li {
 margin: 0;
 padding: 0;
 border-left: 1px solid #E2E2E2;
}

#sidebar li ul {
 margin: 0px 0px;
 padding-bottom: 30px;
}

#sidebar li li {
 line-height: 35px;
 border-bottom: 1px dashed #D1D1D1;
 margin: 0px 30px;
 border-left: none;
}

#sidebar li li span {
 display: block;
 margin-top: -20px;
 padding: 0;
 font-size: 11px;
 font-style: italic;
}

#sidebar h2 {
 height: 38px;
 padding-left: 30px;
 letter-spacing: -.5px;
 font-size: 1.8em;
}

#sidebar p {
 margin: 0 0px;
 padding: 0px 30px 20px 30px;
 text-align: justify;
}

#sidebar a {
 border: none;
}

#sidebar a:hover {
 text-decoration: underline;
 color: #8A8A8A;
}

/* Calendar */

#calendar {
}

#calendar_wrap {
 padding: 20px;
}

#calendar table {
 width: 100%;
}

#calendar tbody td {
 text-align: center;
}

#calendar #next {
 text-align: right;
}

/* Footer */

#footer {
 height: 50px;
 margin: 0 auto;
 padding: 0px 0 15px 0;
 background: #D8E7FE;
 border-top: 1px solid #D3DEF0;
 font-family: Arial, Helvetica, sans-serif;
}

#footer p {
 margin: 0;
 padding-top: 20px;
 line-height: normal;
 font-size: 10px;
 text-transform: uppercase;
 text-align: center;
 color: #A0A0A0;
}

#footer a {
 color: #5389E0;
}

Now wordpress theme is complete. You can upload this whole folder the wp-content/themes directory and activate the theme.

You can download this wordpress theme code form here. Wp-bluemagic

Please write comment for this Post: create wordpress theme from scratch

How do we protect wordpress admin panel and secure it

WordPress admin security is very important. Many people are always take a shared hosting. we given Information about How do we protect wordpress admin panel.  Many people are always take a shared hosting for publishing the wordpress website.

With shared hosting or dedicated you should always think about hack proof wordpress admin panel. So no one can misuse your worepress admin panel. Here in this article I will give you some very nice tips about, how to protect our wordpress admin panel.

protect wordpress admin panel
protect wordpress admin panel

protect wordpress admin panel

1. Create very strong password

Always create a very strong password for your admin user. You should add some special characters and numbers in your password. Your password should be 10 digit minimum and not related to your name or surname.

Main important think is dont disclose your password to anyone.

2. Limit wordpress admin access via IP address

You can use the .htaccess file for limiting the wordpress admin panel for specific ip addresses only. Use following code for that.

<files “wp-login.<span=”” class=”hiddenSpellError” pre=”” data-mce-bogus=”1″>php”>
Order Deny,Allow
Deny from all
Allow from Your.IP.Address

allow from 192.168.2.45

</Files>
[/php]

3. Avoid the “admin” Username

You should always avoid the admin username to login. You can easily achieve this. First create another super admin with another name and open your functions.php file from wordpress theme folder and use following code.


add_filter(‘login_errors’,create_function(‘$a’, “return null;”));

There are some very nice plugins also available for providing the wordpress security your wordpress website. Here are few:

http://wordpress.org/extend/plugins/one-time-password/

http://wordpress.org/extend/plugins/semisecure-login-reimagined/

http://www.bad-neighborhood.com/login-lockdown.html

http://wordpress.org/extend/plugins/stealth-login/

how to pull sticky post from wordpress

From wordpress 2.7 version wordpress introduced the new feature called sticky post. Sticky post will give you ability to show the most popular or your favorite post always top of the posts.

how to pull sticky post from wordpress

how to pull sticky post from wordpress
how to pull sticky post from wordpress

Sticky post feature is very nice for wordpress theme developer. Here I will show you how to create sticky post in wordpress.

When you are creating the new post or editing the wordpress post you can choose the stick ths post option. This is very simple way to create the sticky post.

If you want to some good styling to post then use following css code. Just open your style.css file from your template.


.sticky {
 background: #ccc;
 border: 5px solid blue;
}

If you want to show the sticky post in any specific page then use following code.


is_page('sticky page') {
query_posts(array('post__in'=>get_option('sticky_posts')));
}
how to pull sticky post from wordpress
how to pull sticky post from wordpress

how to use robots.txt file in wordpress

Many person does not know importance of robots.txt file and how to use robots.txt file in wordpress. robots.txt file is important as per search engine.  The robots.txt file is very important as per search engine and SEO prospective.

how to use robots.txt file in wordpress

how to use robots.txt file in wordpress
how to use robots.txt file in wordpress

What is robots.txt file?

Robots.txt is a text (not html) file you put on your site to tell search robots which pages you would like them not to visit. Robots.txt is by no means mandatory for search engines but generally search engines obey what they are asked not to do.

In wordpress you should put robots.txt file. you can use following code in robots.txt file and put that file under your ROOT directory( wordpress main folder)

User-agent: *
Allow: /
Disallow: /*?s=
Disallow: /wp-admin/*
Disallow: /wp-content/*
Disallow: /wp-includes/*
Disallow: /wp-content/cache
Disallow: /wp-content/themes/*<code></code>
Disallow: /wp-content/plugins/*

Important Note: if you are using the QA or testing enviourment then put following lines in your theme header.php file. You can put the domain name condition also.

<?php
if($SERVER)['HTTP_HOST']=='Testing domain name') {
?>

<?php } ?>

You should not disallow the images and comments also because that is more important for SEO purpose. I recommend to use always good permalink structure for your wordpress installation.

how to register multiple sidebar in wordpress

Many wordpress developers and PHP developers who are new in to wordpress development. They really searching for how to add a dynamic or multiple side in wordpress theme. many sidebar or widget are very important to add in any wordpress theme for seo purpose also so you can add the widgets using our code sample.

register multiple sidebar in wordpress

Many wordpress developers got requirement to add separate sidebar for each page or any specific page and that sidebar need to be controlled by wordpress admin.

In this tutorial I will show you how to simply add the multiple or dynamic sidebar to wordpress theme. I really think creating the or putting separate css and options in  the sidebar and admin has no control over the sidebar.

Just use my code to create the multiple sidebar in wordpress theme. This following function is provided by wordpress api only. Open your functions.php file from your wordpress theme folder


<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
 if(function_exists('register_sidebar'))
 register_sidebar(array(
 'name' => 'Home Page', // The sidebar name you can choose as per your choice to register
 'before_widget' => 'PUT YOUR OPENING CSS DIV AND CSS CLASSES AND IDS HERE',
 'after_widget' => 'CLOSE THE DIV',
 'before_title' => '<h2>',
 'after_title' => '</h2>',
 ));
?>

This is sample code for multiple pages your can use following code:


<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
     // Home Page sidebar
     if(function_exists('register_sidebar'))
          register_sidebar(array(
          'name' => 'Home Page',
          'before_widget' => 'PUT YOUR OPENING CSS DIV AND CSS CLASSES AND IDS HERE',
          'after_widget' => 'CLOSE THE DIV',
          'before_title' => '<h3>',
          'after_title' => '</h3>',
     ));
     // Blog Page sidebar
     if(function_exists('register_sidebar'))
          register_sidebar(array(
          'name' => 'Blog Page',
          'before_widget' => 'PUT YOUR OPENING CSS DIV AND CSS CLASSES AND IDS HERE',
          'after_widget' => 'CLOSE THE DIV',
          'before_title' => '<h3>',
          'after_title' => '</h3>',
     ));
     // Contact us Page sidebar
     if(function_exists('register_sidebar'))
          register_sidebar(array(
          'name' => 'Contact Page',
          'before_widget' => 'PUT YOUR OPENING CSS DIV AND CSS CLASSES AND IDS HERE',
          'after_widget' => 'CLOSE THE DIV',
          'before_title' => '<h3>',
          'after_title' => '</h3>',
     ));
     // About us Page sidebar
     if(function_exists('register_sidebar'))
          register_sidebar(array(
          'name' => 'About us',
          'before_widget' => 'PUT YOUR OPENING CSS DIV AND CSS CLASSES AND IDS HERE',
          'after_widget' => 'CLOSE THE DIV',
          'before_title' => '<h3>',
          'after_title' => '</h3>',
     ));

?>

Here is Big question, How can you call the different sidebars and manage it. Go to wordpress admin and you will find and four side bars present in widgets sections as per this code. You can just drag and drop the widgets as your choice.

Open your sidebar.php file put following code in that file.

<?php
is_page('Home Page') {
     if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Home Page')) :
     endif;
}
?>
how to register multiple sidebar in wordpress
how to register multiple sidebar in wordpress

You can use the following type of code in your sidebar.php file as per your condition. If you have any issues get back to me.