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.
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
To create the favicon image you should follow following rules
By cropping or adding space around the image, make the image square.
Resize the image to 16 x 16 pixels.
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.
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.
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.
Here for this tutorial I am using following image for creating the wordpress theme.
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:
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;"> </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> | <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;"> </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> | <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;"> </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> | <a href="#">Comments</a></p>
</div>
</div>
<div style="clear: both;"> </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;"> </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.
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"); ?>">»</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 »'); ?></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.
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.
When we are work with wordpress theme. So many times we want to show recent posts without wordpress plugin in wordpress theme. Many people suggest to use wordpress plugin for showing the recent post.
How to show recent posts without wordpress plugin
But I suggest not to use any wordpress plugin for showing the recent posts in wordpress theme.
In this tutorial I will tell very simple technique to show recent posts. Following code you can use in your sidebar.php or in footer.php or anywhere as per your theme requirement.
Just put following code in your theme file. You just need to change the showposts count as per choice.
<?php
$recent_posts = new WP_Query('showposts=15');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>
Your recent post will look this. You just need to customize css as per your wordpress theme.
Many wordpress theme developer when create new wordpress theme, they need to think about 404 page must. In this article I going to give you information about how to create 404 page in wordpress theme with classic design.
create 404 page in wordpress theme
What is 404 page?
The 404 or Not Found error message is an HTTP standard response code indicating that the client was able to communicate with the server but the server could not find what was requested. 404 errors should not be confused with “server not found” or similar errors, in which a connection to the destination server could not be made at all. Another similar error is “410: Gone”, which indicates that the requested resource has been intentionally removed and will not be available again. A 404 error indicates that the requested resource may be available in the future.
I recommend to wordpress theme developer create customize 404 page in wordpress theme. Go to google custom search engine page and get google search engine code for your website from following URL:
I used here my websites search engine code. Dont forget to change the google search engine code as your web site.
The 404 or Not Founderror message is an HTTPstandard response code indicating that the client was able to communicate with the server but the server could not find what was requested. 404 errors should not be confused with “server not found” or similar errors, in which a connection to the destination server could not be made at all. Another similar error is “410: Gone”, which indicates that the requested resource has been intentionally removed and will not be available again. A 404 error indicates that the requested resource may be available in the future.
So many people like black color. They looking for black and white WordPress themes. We like black themes. Here List of best free black wordpress themes, Black color is always loved by people so here I collected the very nice wordpress themes which are black.
If we kept black color in background then web page will become more attractive as graphic designers are says. I specially like black wordpress themes.
Best free black WordPress Themes – Dont miss it
Here in this article I will give information about some really cool Black WordPress themes. 1. Michael Jackson 1.0
When I started the Blogging, First I started about Portfolio WordPress theme. I got so many wordpress themes but I was looking for only portfolio wordpress themes.
I found portfolio wordpress themes but that most of all are paid portfolio wordpress themes. we have a collection of best free portfolio wordpress themes.
free portfolio wordpress themes
I got very super classic portfolio wordpress themes but that most of all are paid wordpress themes.
Here in this article I am going to tell you about best portfolio wordpress themes.
You can use for your portfolio and for your website. All themes are free to download and you can view the demo also.