Solved :Error establishing a database connection

Many times I saw this message. “Error establishing a database connection”. That time I did not understand why this message is coming.

When started working on WordPress blog Plugins, Themes. Then I got to know about this error.
Whenever you mis-configured the wp-config.php file. You will this kind of error.

You need to Fill following information correctly:(dont forget to create database your own)
** The name of the database for WordPress */

define(‘DB_NAME’, ‘wordpress’);

/** MySQL database username */

define(‘DB_USER’, ‘root’);

/** MySQL database password */

define(‘DB_PASSWORD’, ”);

/** MySQL hostname */

define(‘DB_HOST’, ‘localhost’);

This will solve your problem.

Desktop application for WordPress post

We use to write my wordpress blog daily. That is like our habit. That is like my habit. WordPress visual editor is so good. We need to login each time to wordpress and write a blog post. page refreshing, checking post that part is boring. List of Desktop application for WordPress.

Desktop application for WordPress post

So I looked for solution to write blog from desktop application. I found very use full application which is free for wordpress.

Website: Zoundry.com

Desktop application for WordPress post
Desktop application for WordPress post

Price: Free

Summary: This software is excellent! This is what I had in mind when I set out to find desktop blogging software for wordpress. The usability is excellent. Initially, I expected some type of configuration wizard or walk-through. Instead, what I received was a panel that had the steps with links on how to set up my blog for Zoundry lovin’. I believe it worked better than a walk-through could have, since it taught me the way to set up another blog if I needed it. This app got out of my way and let me do what I set out to do. Zoundry was definitely built by a programmer with excellent usability experience.

Advantages:

  • Automatic blog-type discovery (just provide the URL!)
  • Easy to set up accounts
  • Imports your blog posts
  • Getting started tab guides you through blog set up
  • HTML validator built into the code view (big plus)
  • WYSIWYG features still usable in code view
  • Includes a publish menu to finalize your decisions, tags, trackbacks, etc.

Disadvantages:

  • Scroll wheel on my mouse crashed the entire app on the publish menu. Luckily, Zoundry has an auto save feature which recovered the post I had started. Nice.
  • Interface is a little cluttery

How to show Twitter Followers Count on wordpress widget

We all are having the twitter account. If we want to show Twitter Followers Count on wordpress widget then just use our code.

How to show Twitter Followers Count on wordpress widget

Open your sidebar.php file and just copy paste the following code.

First you would need to create a file twitter.php and paste the following code in there:


<?php

//This xml file will return the all user information about from twitter account
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=wordpressapi');
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$twitter_follower_count['count'] = $match[1];

// this will show the twitter followers count
echo $twitter_follower_count['count'];
?>

WordPressapi is my twitter username. So you can change it your username.

How to add HTML code on WordPress home page

Some time we want to show Some custom text or HTML code on home page. In this article we given tricks and steps to add HTML code on WordPress home page.

How to add HTML code on WordPress home page

  • First method

you need go to wordpress admin panel.Create page with home name. Add your HTML or custom text in that page.

Go to Setting->reading section. There is “Front page displays”  section. We can found following two radio box over there.

  • Your latest posts
  • A static page (select below)

Select “A static page (select below) ” radio box. Than from “Front page:” select box, select the Home page. That sit.

How to add HTML code on WordPress home page
How to add HTML code on WordPress home page
  • Second Method

If you want to add some different text or HTML code, than you need open functions.php file which you found in wordpress themes folders. Just copy and paste following code in that file.


<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php

if (is_home() {
echo "HTML CODE GOES HERE OR TEXT";

}

?>

Note: You need replace HTML code. I used sample text in code.

Have fun!

How to fetch Feedburner Subscriber Count in wordpress

We all are using the feedburner button in wordpress sites. In this article showing, How to fetch Feedburner Subscriber Count in wordpress website using our code.

How to fetch Feedburner Subscriber Count in wordpress

Just copy paste the following code in your sidebar.php file(This file you will find in your template folder.)

<?php

//You need to change the uri parameter to your website name
$whaturl=”http://api.feedburner.com/awareness/1.0/GetFeedData?uri=wordpressapi/ZoqV”;

//Initialize the Curl for using the feedburner api
$wordpressapi = curl_init();

//Set curl to return the data instead of printing it to the browser.
curl_setopt($wordpressapi, CURLOPT_RETURNTRANSFER, 1);

//Set the URL
curl_setopt($wordpressapi, CURLOPT_URL, $whaturl);

//fetching data
$data = curl_exec($wordpressapi);

//Closing connection
curl_close($wordpressapi);
$xml = new SimpleXMLElement($data);
$fbcount = $xml->feed->entry[‘circulation’];
echo $fbcount;
//end get cool feedburner count
?>

Echo $fbcount will print the feed Subscriber count.

add custom header to different categories in WordPress

wordpress tutorial for add custom header, footer, or sidebar for different categories in WordPress. we have given simple conditinal code which need to use in your theme file.

add custom header to different categories in WordPress

If you want to add the different header for each category then use the following code in your index.php where “get_header()” method is called.

Create the Header-new_category.php file and put your header code in that file as per requirement.

For sidebar use this code:


<?php if (is_category(‘new_category’)) {
get_header(' new_category ');
} else {
get_header();
} ?>

Create the Header-new_category.php file and put your header code in that file as per requirement.

For sidebar use this code:


<?php if (is_category('New_category')) {
get_sidebar('new_category');
} else {
get_sidebar();
} ?>

Create the sidebar-new_category.php file and put your sidebar code in that file as per requirement.

For Footer use this code:


<?php if (is_category('New_category')) {
get_footer('new_category');
} else {
get_footer();
} ?>

 

 

Create the footer-new_category.php file and put your footer code in that file as per requirement.

Cheat Sheets for creating WordPress Themes and Plugins

Here is the list of cheat sheets which are very useful when your developing new theme or plugin. For wordpress theme developer and plugin developers cheat sheets are very important. We collected the nice collection Cheat Sheets for creating WordPress Themes and Plugins.

Cheat Sheets for creating WordPress Themes and Plugins

WordPress Theme Development Checklist

Download PDF : Download Cheat Sheet »
Source : http://startbloggingonline.com

WordPress Theme Development Checklist

WordPress CheatSheet

Download PDF : Download Cheat Sheet
Source : andywibbels.com

WordPress CheatSheet

The WordPress Help Sheet

Download PDF : Download Cheat Sheet
Source : http://www.fylrr.com

The WordPress Help Sheet

WordPress SEO Cheat Sheet

Download PDF : Download Cheat Sheet
Source : tekka.de

Wordpress SEO Cheat Sheet

WordPress Template Tags

Download PDF : Download Cheat Sheet
View HTML Version : View HTML Cheat Sheet
Source : bueltge.de

WordPress Template Tags

WP Widget Cheat Sheet

Download PDF : Download Cheat Sheet
Source : bueltge.de

WP Widget Cheat Sheet

WordPress Loop

Download PDF : Download Cheat Sheet
Source : bueltge.de

WordPress Loop

WP Plugin API Cheat Sheet

Download PDF : Download Cheat Sheet
Source : bueltge.de

WP Plugin API Cheat Sheet

find replace content in post wordpress

Some times we need to change specific text in wordpress. Using mysql database query or PHPmyadmin interface, you can find replace content in post wordpress. We have given mysql query for replacing the content using database.

find replace content in post wordpress

Use this query for wordpress users


UPDATE wp_1_posts SET post_content = REPLACE(post_content, 'www.test.com', 'www.secondtest.com');

Use this query for wordpress

UPDATE wp_posts SET post_content = REPLACE(post_content, 'www.test.com', 'www.secondtest.com');

How to show or exclude Certain Categories in a Menu – WordPress

If you want show only some categories in wordpress menu than use following command in header.php.

<ul style=”float:left; width:840px;”>
php wp_list_categories(‘orderby=name&include=5,4,8,9,52,65,35’); ?>
ul>

If you want exclude some categories in wordpress menu than use following command in header.php.

840px;”>
php wp_list_categories(‘orderby=name&exclude=5,4,8,9,52,65,35’); ?>
</ul>

Following Options we can use with “wp_list_categories” method.

<?php wp_list_categories( $args ); ?>

args = array(
'show_option_all' => ,
'orderby' => 'name',
'order' => 'ASC',
'show_last_update' => 0,
'style' => 'list',
'show_count' => 0,
'hide_empty' => 1,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => ,
'feed_type' => ,
'feed_image' => ,
'exclude' => ,
'exclude_tree' => ,
'include' => ,
'current_category' => 0,
'hierarchical' => true,
'title_li' => __( 'Categories' ),
'number' => NULL,
'echo' => 1,
'depth' => 0 ); ?>

 

By default, the usage shows:

  • No link to all categories
  • Sorts the list of Categories by the Category name in ascending order
  • Does not show the last update (last updated post in each Category)
  • Displayed in an unordered list style
  • Does not show the post count
  • Displays only Categories with posts
  • Sets the title attribute to the Category Description
  • Is not restricted to the child_of any Category
  • No feed or feed image used
  • Does not exclude any Category and includes all Categories
  • Displays the active Category with the CSS Class-Suffix ‘ current-cat’
  • Shows the Categories in hierarchical indented fashion
  • Display Category as the heading over the list
  • No SQL LIMIT is imposed (‘number’ => 0 is not shown above)
  • Displays (echos) the categories
  • No limit to depth
  • All categories.

solution for plugins are not working on wordpress theme

solution for plugins are not working on wordpress theme. Whenever you developing the new theme. You need to add following code in your theme file.

solution for plugins are not working on wordpress theme

</p>
wp_head();

Goes in the HTML <head> element of a theme; header.php template. Example plugin use: add javascript code.

Usage: <?php do_action('wp_head'); ?>

-or- <?php wp_head(); ?>

wp_footer

Goes in the “footer” of a theme; footer.php template. Example plugin use: insert PHP code that needs to run after everything else, at the bottom of the footer.

Usage:


<tt><?php do_action('wp_footer'); ?></tt>

-or-

</tt>

<tt><?php wp_footer(); ?></tt>

wp_meta();

 

Typically goes in the <li>Meta</li> section of a theme's menu or sidebar; sidebar.php template. Example plugin use: include a rotating advertisement or a tag cloud.

Usage:


<tt><?php do_action('wp_meta'); ?></tt>

-or-

</tt>

<tt><?php wp_meta(); ?></tt>

comment_form

Goes in comments.php and comments-popup.php, directly before the comment form's closing tag (</form>). Example plugin use: display a comment preview.

Usage:

</tt>

<tt><?php do_action('comment_form', $post->ID); ?></tt>

Note: don’t forget to add wp_head, wp-footer and wp_meta methods in you theme.