register activation hook using in wordpress plugin

wordpress hooks are very important for wp developers. We can use the wp hooks in wordpress plugin and themes. Here in this article I will show you how to register the hook in wordpress plugin. I given the simple code sample which will give you the fare idea about using the wordpress hooks.

register activation hook using in wordpress plugin

register activation hook using in wordpress plugin
register activation hook using in wordpress plugin

register_activation_hook is very important function for creating the wordpress plugin. The function register_activation_hook registers a plugin function to be run when the plugin is activated.
You can use the register_activation_hook as follows:

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php register_activation_hook($file, $function); ?>

If you can going to create the wordpress simple plugin then this function is very useful. this function you can use as follows in files.
If you have a function called myplugin_activate() in the main plugin file at either

* wp-content/plugins/myplugin.php or
* wp-content/plugins/myplugin/myplugin.php

you can use code as follows:

global $myvar;
$myvar='whatever';

function myplugin_activate() {
  global $myvar;
  echo $myvar; // this will be 'whatever'
}

register_activation_hook( __FILE__, 'myplugin_activate' );

1. register_activation_hook() must be called from the main plugin file – the one that has “Plugin Name: …” directive.
2. Your hook function must be in the same file as well. From that function it is ok to call other functions defined in other files.
3. Doing echo “My hook called!”; – does not work from it. So this is not a good way to judge whether it working or not.
4. Your global variables must be explicitly declared as global for them to be accessed from inside of my_activation_hook().

Check the sample wordpress plugin code.

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
/*
Plugin Name: A Test
Description: A Test
*/

require_once (dirname(__FILE__) . '/my_other_file.php');

// This code *will not* work. Activation hook function must be defined in the main plugin file.
//    register_activation_hook (dirname(__FILE__) . '/my_other_file.php', 'my_other_function');

// This code will work.
register_activation_hook (__FILE__, 'test_activated');

// This is correct way to declare/access globals.
global $some_var;    // globals must be declared explicitly. Without this you will not be able to access '$some_var' from within 'test_activated()' function.
$some_var = 'hey';

//===========================================================================
function test_activated ()
{
   global $some_var; // Now it will be 'hey'.

   // This function is defined in 'my_other_file.php'
   my_other_function ();

   // This will not work, so don't try. If you need logging write something in temporary log file in here via fopen/fwrite.
	// If you want to quickly test if your activation hook works - put exit() into it. At least you'll see error during activation.
   echo 'test_activated called!';
}
//===========================================================================

?>

The function register_deactivation_hook registers a plugin function to be run when the plugin is deactivated.
following function will deactivate your plugin

register_deactivation_hook( __FILE__, 'myplugin_deactivate' );

wordpress theme help for wordpress developers

Many People want to create the wordpress theme. But they don’t know where to start and how to start. We given wordpress theme help for wordpress developers. For creating the wordpress theme only two files are important. First file is style.css file and index.php file if you create that only two files in your wordpress theme folder than also you can able to create the wordpress theme easily.

wordpress theme help for wordpress developers

Here I will show you which is necessary files in wordpress theme folder.

header.php - header section
index.php - main section
sidebar.php - sidebar section
footer.php - footer section
single.php - post template
page.php - page template
comments.php - comments template
search.php - search content
searchform.php - search form
archive.php - archive
functions.php - special functions
404.php - error page

If you have very basic knowledge of php then you are able to create Above files very easily. In index.php file you need the PHP loop for showing the wordpress posts.

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php if(have_posts()) : ?>
   <!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php while(have_posts()) : the_post(); ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php the_title(); ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php the_content(__('(more...)')); ?>
// Custom HTML & PHP code
   <!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php endwhile; ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php else : ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php endif; ?>

Using above code you can show the wordpress posts in your wordpress theme. Just you need to put above code in right place where you want to show the multiple posts.

Then Cut the header part of index.php file and put in header.php file and put < ?php get_header(); ?>
instead of deleted header part.

Then Cut the sidebar part of index.php file and put in sidebar.php file and put < ?php get_sidebar(); ?>
instead of deleted sidebar part.

Then Cut the footer part of index.php file and put in footer.php file and put < ?php get_footer(); ?>
instead of deleted footer part.

In single.php file you need to copy paste the index.php file and then put following code in the loop for showing the comments.

<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php if(have_posts()) : ?>
   <!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php while(have_posts()) : the_post(); ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php the_title(); ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php the_content(__('(more...)')); ?>
// Custom HTML & PHP code
   <!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php endwhile;
comments_template();
?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php else : ?>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php endif; ?>

Above tags we called as template tags in wordpress api and themes.
In header.php file following lines or code is important. For title, description for blog home, theme url following code is useful. Following tags we called as “Template Bloginfo Tags”.
Where you want to show the title use following code.

< ?php bloginfo('name'); ?> - Title of the blog
< ?php bloginfo('charset'); ?> - Displays the character set
< ?php bloginfo('description'); ?> - Displays the description of the blog
< ?php bloginfo('url'); ?> - Displays the address of the blog
< ?php bloginfo('rss2_url'); ?> - Displays the RSS URL
< ?php bloginfo('template_url'); ?> - Displays the URL of the template
< ?php bloginfo('pingback_url'); ?> - Displays the pingback URL
< ?php bloginfo('stylesheet_url'); ?> - Displays the URL for the template's CSS file
< ?php bloginfo('wpurl'); ?> - Displays URL for WordPress installation
< ?php bloginfo('name'); ?>

Common and very useful wordpress theme tags as follows.

< ?php the_time() ?> - Displays the time of the current post
< ?php the_date() ?> - Displays the date of a post or set of posts
< ?php the_title(); ?> - Displays or returns the title of the current post
< ?php the_permalink() ?> - Displays the URL for the permalink
< ?php the_category() ?> - Displays the category of a post
< ?php the_author(); ?> - Displays the author of the post
< ?php the_ID(); ?> - Displays the numeric ID of the current post
< ?php wp_list_pages(); ?> - Displays all the pages
< ?php wp_tag_cloud(); ?> - Displays a tag cloud
< ?php wp_list_cats(); ?> - Displays the categories
< ?php get_calendar(); ?> - Displays the calendar
< ?php wp_get_archives() ?> - Displays a date-based archives list
< ?php posts_nav_link(); ?> - Displays Previous page and Next Page links
< ?php next_post_link() ?> - Displays Newer Posts link
< ?php previous_post_link() ?> - Displays previous link

With this article I attached the very useful wordpress 3.0 help functions list. Please download that also.

WordPress 3.0 Cheat Sheet wordpress theme help for wordpress developers
wordpress functions and theme help wordpress theme help for wordpress developers

How do I get wordpress API Key

Many people are running there site with wordpress. For many reasons We need to WordPress api key. For using the wordpress stat and akismet plugin we need the wordpress api key. In this article we given details for get wordpress API Key

How do I get wordpress API Key

How to get the free wordpress api key?

Go to following URL:

http://akismet.com/personal/

How do I get wordpress API Key
How do I get wordpress API Key

Put your email address and click on register button.

How do I get wordpress API Key
How do I get wordpress API Key

Click on use Akismet for free! Link. Than fill all your information in the form and hit the Next button.

After submission you will see the following message.

You will get the wordpress api through wordpress in following format.

Thanks for choosing Akismet.

Your Akismet API key is: ------------

If you have any questions or concerns about your Akismet subscription, don't hesitate to ask:

http://akismet.com/contact/

Thanks,
The Akismet team.

free wordpress themes for hotels and resorts, restaurants and travel

In Hotel site you need to add many images and media and reviews about customer. we have unique free wordpress themes for hotels and resorts.

free wordpress themes for hotels and resorts

Biggest to smallest hotel and restaurant required the website now. Wordpres is best and perfect solution for this. In Hotel site you need to add many images and media and reviews about customer. In wordpress creating the hotel or restaurant site is very nice and easy. There are too many free wordpress themes which can be usable for creating hotel site with wordpress. In this article I am going to give very nice options about free wordpress themes for hotels or Restaurants.

Hotels WordPress Theme

free wordpress themes for hotels and resorts
In Hotel site you need to add many images and media and reviews about customer. we have unique free wordpress themes for hotels and resorts.

Demo | Download

DeLuxe

Demo | Download

Hotel

Demo | Download

Hotel Lobby

Demo | Download

SW Hotel

Demo| Download

Hotel Nights

Demo | Download

Golden Palace Hotel Theme

Demo | Download



WordPress themes for Beer Bars and Drinks

WordPress became popular in last few year. The best part of wordpress the great SEO tool. That’s why many people want to create their website using wordpress. It is fast and highly customizable.

Free WordPress themes for Beer Bars and Drinks

Here I am going to give some cool wordpress themes for Beer Bars and Drinks collection. It is free wp themes for beer bars. You can find many free wordpress themes which can be useful for beear bars and hotels. Following list is unique and carefully collected wp themes. If you use these themes then you can easily customize them as per your requirements.

We did used some these themes for our clients and after few customization and adding new content and images, It was looking so nice and great. You should try these themes. If you are looking for beer bars wordpress themes.

1. Red Wine

Wordpress themes for Beer Bars and Drinks
WordPress themes for Beer Bars and Drinks

Demo | Download

2. Wine Clean

Demo | Download

3. Unwind

Demo | Download

4. Darkred

Demo | Download

5. New-wine

Demo | Download

Free WordPress themes for Yoga and Skin and Health

build site with free wordpress themes for yoga, skin, spa, beauty salon, health, fitness sites in wp. We collected nice list of free wordpess themes for creating Yoga and Skin and Health related site.

Many people want to create there Yoga center , Beauty or health center websites in wordpress. Many times we spend time to on searching wordpress themes related that.

free wordpress themes for yoga, skin, spa, beauty

Here I am going to tell some very nice and cool Yoga, skin and health wordpress themes.

1. Breathe and Stretch

free wordpress themes for yoga, skin, spa, beauty
free wordpress themes for yoga, skin, spa, beauty

LIVE DEMO | Download Breathe and Stretch

2. Gracia

3. Yoga
4. Beauty

DEMO | DOWNLOAD

6. Jeine health WordPress Theme

Demo | Download

Dont use WP-Robot plugin ever in WordPress blog

First reason I must say that google does not like the wp-robot wordpress plugin. Unique and good quality contents are what you need to RANK. Dont use WP-Robot plugin ever in WordPress blog.

What is Wp-Robot?

WP Robot is an autoblogging plugin for WordPress weblogs. It will enable the user to create targeted blog posts on any topic without having to write anything. Blogs will be set on auto-pilot and fresh content will be entered on a schedule that the user specifies and the posts can be on any topic and will be targeted to any keyword desired. Content can be taken from any source including Amazon, Ebay, ClickBank, and YouTube.

Many People think they will earn money easily from this plugin. But that is not true. If you use wp-robot plugin for month you will get to know. Not single article is indexed by google.
Because Google will check the article title and content and That content is duplicate then google never index that page.
Your articles will never comes in picture. It might be possible in that blog you will right the your own articles but still due to wp-robot google will never index your article.
Google might ban your domain name due to wp-robots. Earlier this is happened with some domain names due to wp-robots.
So My advice to all bloggers dont use wp-robots ever.

How to add new User types in WordPress site

Adding and managing the New User types and role management in any CMS is very basic requirement of any CMS. In wordpress also we can create the multiple User types and manage there roles through admin panel. In this article I shown, How to add new User types in WordPress site.

 

How to add new User types in WordPress site

How to add new User types in WordPress site
How to add new User types in WordPress site

For managing the Role capabilities we need to include one wordpress plugin. This plugin is compatible upto wordpress 3.0.1 and we can create multiple user roles and set user permissions through admin panel.

User Role Editor

User Role Editor WordPress plugin makes the role capabilities changing easy. You can change any standard WordPress user role (except administrator) with a few clicks. Just turn on check boxes of capabilities you wish to add to the selected role and click “Update” button to save your changes. That’s done. In case you made some unneccessary change you always have the “Reset” button to restore roles state from the automatically made backup copy. Add new roles and customize its capabilities according to your needs. Unnecessary self-made role can be deleted if there are no users whome such role is assigned. Role assigned every new created user by default can be changed too.

How can user delete their own account from WordPress site

Creating, editing and deleting the user account is a very basic need of any CMS. We can easily allow user to register their account in wordpress sites. We shown in this article, How can user delete their own account from wordPress site. We can use many wordpress plugins and create User profile and manage their profile.

How can user delete their own account from WordPress site

How can user delete their own account from WordPress site
How can user delete their own account from WordPress site

But in wordpress deleting the User from wordpress site is not easy. Here in this article I will tell how can we easily delete the user account without administrator permission.

Using following wordpress plugin we can achieve this functionality.

User Self Delete

This plugin will allow your users to delete their own account without any need for interaction on the administrator’s behalf.

When a user wishes to delete their account, they are taken to a confirmation page where they must enter the word “yes” in order for the deletion to take place. Once they type “yes” and press the delete account button, they are redirected to the login page and they no longer exist as a user on your site.

WordPress.com announcement: Like a Post? Well Then, “Like” It!

Yesterday When I logged to my wordpress blog account I saw the following announcement under my dashboard.

WordPress.com announcement: Like a Post? Well Then, “Like” It!

I checked the that link and I got the news about like button. When I checked the post in my blog then I am able to see the like button under my each post.

Note: This functionality is enabled with self hosted wordpress blogs.

What features Like button is having?

A ‘like’ button will be present at the end of every blog post, similar to the feature on social networking site, Facebook. If a viewer ‘likes’ a post, the author can browse through the blog profile of the viewer. This is designed to promote interaction between bloggers who share similar ideas and interests.

When you “like” a post two core things happen. First, the blog post’s author sees your “like” and can click-through to your Gravatar profile. Second, clicking “like” saves the post in your homepage dashboard (in the “Posts I Like” section), so you can share it with others, or just keep it around for future reference. If you’re interested in keeping track of how many likes your own blog posts are receiving, there’s a new “like count” column on the “Posts > Edit Post” screen. This will show you the total like count on each of your posts, right next to the total comment count.

We’re hoping this will be an awesome new way to discover other interesting bloggers, and start new conversations with people who — literally! — like you. If you haven’t updated your Gravatar profile yet, now would be a great time to upload a picture, a link to your blog, and any other details. Editing your profile is easy, just remember that all of your profile information is public.

If you dont want to show the like button then follow the bellow steps

If you’d prefer not to display likes on any of your blog posts we’ve provided an option to turn them off under “Appearance > Extras.” You can still enable or disable likes selectively on individual posts through the “Show likes on this post” checkbox when editing or writing a new post.

I love the wordpress they are keep adding very interesting stuff in wordpress blogs.