How to Separate Pingbacks From Comments

1:48 AM |
wordpress logoWith the popularity of social networking sites, such as Twitter and Facebook, there has been an increase of pingbacks and external comments. Therefore, some bloggers find it easier to separate the two, so it’s easier for their readers and themselves to distinguish between the two. This can be done in two ways: Using a WordPress plugin or manually changing your blog’s code.

What are pingbacks and trackbacks?


Pingbacks and trackbacks are very similar, but other than using different communication technologies (Pingbacks use XML-RPC; Trackbacks use HTTP POST), there are only minor differences. Pingbacks are a way of keeping track of other blogs who have linked to your blog posts within their own blog posts. In order to do this, external blogs have to use your blog post’s hyperlink. Trackbacks work the same, except the blog post’s hyperlink is not placed within an external blog post. They are usually placed in an area specified for trackbacks. Additionally, pingbacks automatically will find the URLs; while trackbacks are done manually.
Read more…

Qumana: An Easy-to-Use Alternative to Desktop Blogging

1:45 AM |
qumana_newpost

Desktop blog editors provide bloggers additional functionalities that are missing in your blog’s default editor (e.g. WordPress, Blogger, LiveJournal, etc.). Additionally, you are able to write and edit your blog posts offline, which provides a way to save your work on your computer’s hard drive while also not having to be connected to the Internet. One of the best desktop-based blog editors is Qumana.
Read more…

Useful WordPress wp-config Tricks That You May Not Know

1:35 AM |
wp-configIf you are one of the many who install WordPress via Fantastico, chances are, you won’t even know the existence of the wp-config file in WordPress. The wp-config.php file is one of the most important files in Wordpress. It holds the keys to your database and also many of the configuration options that you never know you can do with WordPress. Here are some tricks that you can get your WordPress to do by editing the wp-config file.

1. Database settings


define('DB_NAME', 'putyourdbnamehere');

define('DB_USER', 'usernamehere');

define('DB_PASSWORD', 'yourpasswordhere');

define('DB_HOST', 'localhost');

This is the first thing that you need to configure in order for WordPress to work. In most cases, you only need to change the database name, username and password. For the DB_HOST, ‘localhost’ should work most of the times. If not, ask your server administrator for details.

2. Changing the database charset value


define('DB_CHARSET', 'utf8');

You won’t have to change this value 99% of the time. Change this only if you are very sure that your database is using a different charset.

3. Changing the database character set sort order


define('DB_COLLATE', '');

Once again, change this only if you know what you are doing. If not, leaving it blank is the best option.

4. Authentication keys


define('AUTH_KEY', 'put your unique phrase here');

define('SECURE_AUTH_KEY', 'put your unique phrase here');

define('LOGGED_IN_KEY', 'put your unique phrase here');

define('NONCE_KEY', 'put your unique phrase here');

The authentication keys are used to insure better encryption of information stored in the user’s cookies. Go to https://api.wordpress.org/secret-key/1.1/ to generate a new set of keys and copy/paste them into your wp-config.php file.

If you are using WPMU, you will see three extra sets of authentication keys:
define('AUTH_SALT', 'put your unique phrase here');

define('LOGGED_IN_SALT', 'put your unique phrase here');

define('SECURE_AUTH_SALT', 'put your unique phrase here');

5. Table prefix


$table_prefix = 'wp_';

This $table_prefix settings allow you to change the default wp_ prefix before your WordPress installation.

Note: If your existing database is already using the default wp_ prefix, changing this value will not change the database value, and it will also cause your site to break. To change your existing table prefix.

6. Language and Language Directory


define('WPLANG', 'de_DE');

define('LANGDIR', 'mylanguagedirectory');

If you are using a language translation file for your blog, this is where you define the language that you are using and the location of the translation (.mo) files.

Defining of LANGDIR is optional. If it is not specified, WordPress will first look up the wp-content/languages folder, follow by wp-includes/languages for the .mo file.

7. Defining the Home and site url


define('WP_SITEURL','http://your-site-url.com');

define('WP_HOME','http://your-site-url.com');

The SITEURL refers to the actual installation path of WordPress (the file path where the wordpress files are located) while the HOME refers to the URL that you want your visitor to access. There are several uses for this

  1. For security measure. Install your wordpress in subfolder and have your visitors access them from the root directory

  2. Migrating to new URl. When you are moving to a new URL, you can easily restore your database by pointing the WP_SITEURL and WP_HOME to the new URL. No editing of the database is required.


8. Revision count


define('WP_POST_REVISIONS', FALSE);

define('WP_POST_REVISIONS', 3);

Change the number of post revisions for WordPress to record. Giving it a value of FALSE (without the quote) will turn post revisions off.

9. Modify AutoSave Interval


define('AUTOSAVE_INTERVAL', 160 );

When editing a post, WordPress uses Ajax to auto-save revisions to the post as you edit. You may want to increase this setting for longer delays in between auto-saves, or decrease the setting to make sure you never lose changes. The default is 60 seconds.

10. Define new wp-content location


define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content' );

define( 'WP_CONTENT_URL', 'http://example/blog/wp-content');

define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/blog/wp-content/plugins' );

define( 'WP_PLUGIN_URL', 'http://example/blog/wp-content/plugins');

Since WP2.6, you are allowed to move the wp-content folder to other destination and still get it working. You just need to specify the filepath of the new location in the wp-config file.

11. Access external configuration files


require_once(‘FilePathToConfigurationFiles’);

For developer, if you need to access external configuration file from within WordPress, the place to define it will be within the wp-config.php. This is useful when integrating another software with WordPress. For example, to integrate bbpress with WordPress, add the following
require_once(‘filepathtoforums/bb-load.php');

to access to the bbpress functions in WordPress.

12. Managing your cookies


define('COOKIE_DOMAIN', '.yoursite.com');

define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('home') . '/' ) );

define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', get_option('siteurl') . '/' ) );

define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );

define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );

The cookie definition is meant for sites with unusual domain setup. If you are using sub-domains to serve static content, you won’t want WordPress to track the cookies for the static sites. Simply define the COOKIE_DOMAIN option to limit the domain tracked by the cookie.

13. Debug


define('WP_DEBUG', true);

The WP_DEBUG option is especially useful when you are developing a WP site. It allows you to see what went wrong in the code. In actual production site, this option should be turned off (FALSE) as it can affect the performance of the site.

Additionally, if you are planning on modifying some of WordPress’ built-in JavaScript, you can enable the following option:
define('SCRIPT_DEBUG', true);

This will allow you to edit the scriptname.dev.js files in the wp-includes/js and wp-admin/js directories.

14. Configure Error Log


@ini_set('log_errors','On');

@ini_set('display_errors','Off');

@ini_set('error_log','/home/example.com/logs/php_error.log');

This option allows you to turn on php error_logging and logs them to a specific file. This is especially useful for those who have no access to the php.ini file.

15. Increasing memory allocated to PHP


define('WP_MEMORY_LIMIT', '64M');

Specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”.

16. Cache


define('WP_CACHE', true);

Activate the WP_CACHE for better site performance.

17. Custom User and Usermeta Tables


define('CUSTOM_USER_TABLE', $table_prefix.'my_users');

define('CUSTOM_USER_META_TABLE', $table_prefix.'my_usermeta');

Save the user data to other table instead of the default wp_users.

18. Save queries for analysis


define('SAVEQUERIES', true);

The SAVEQUERIES option allows you to see all the queries made to the database. You can then analyze those queries and see the function that called it, and how long that query took to execute.

NOTE: This will have a performance impact on your site, so make sure to turn this off when you aren’t debugging.

To view the queries, place the following code in the footer of your theme:

<?php

if (current_user_can(‘level_10′)){

global $wpdb;

echo “<pre>”;

print_r($wpdb->queries);

echo “</pre>”;

}

?>

The code above uses the level_10 capability so only the administrator will see the query results.

19. Override of default file permissions


define('FS_CHMOD_DIR', (0755 & ~ umask()));

define('FS_CHMOD_FILE', (0644 & ~ umask()));

The above two options allow you to override the default file permissions. You won’t have to define this in most cases. However if your webhost uses restrictive permissions for all user files, then this is the way to go around it.

20. FTP/SSH Constants


define('FS_METHOD', 'ftpext');

define('FTP_BASE', '/path/to/wordpress/');

define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');

define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');

define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub');

define('FTP_PRIKEY', '/home/username/.ssh/id_rsa');

define('FTP_USER', 'username');

define('FTP_PASS', 'password');

define('FTP_HOST', 'ftp.example.org:21');

WordPress allows you to upgrade the core version and plugins from within the backend. However, some of you might not be able to enjoy the benefits due to the FTP connection issue. Simply update your wp-config file with the necessary FTP credential and your WP upgrade function should work fine.

21. Control Proxy Access


define('WP_HTTP_BLOCK_EXTERNAL', false);

define('WP_ACCESSIBLE_HOSTS', 'api.wordpress.org');

The above options allow you to access external hosts from your domain. This is useful if you are in a restrictive environment (such as your comapny’s intranet) and you need to access an external host.

Protecting wp-config file


With so many information in the wp-config.php file, the last thing that you want is for hacker to see your wp-config file and gain access to your database.

Add the following code to your .htaccess file to prevent hackers from accessing your wp-config file.
# protect wpconfig.php

<files wp-config.php>

order allow,deny

deny from all

</files>
Read more…

Make Your WordPress Blog iPhone Compatible Using WPtouch

1:28 AM |
WPtouch DemoI’m sure most of you would agree with me that the iPhone is the world’s most popular smartphone. Even if you don’t agree with that statement per se, you’d definitely agree that it is the world’s most popular smartphone for accessing the Internet.

There was a time when web pages had to be written specially for mobile devices and most devices available in the market just couldn’t display regular web sites designed using HTML.

The Safari browser on the iPhone and iPod touch devices is responsible for more than half of the world’s mobile Internet usage and it doesn’t look like that uptrend is going to change soon. The reason behind this popularity is that, unlike other smart phone browsers, mobile Safari can display regular webpages as well as desktop based web browsers.

But, while the iPhone and iPod touch browsers display almost all websites perfectly, using a mobile specific theme you can offer a lot of advantages to your visitors.

For one, the mobile optimized pages will load a lot faster. The fonts will be optimized for reading on a device with a small screen and last but not the least, the user won’t have to scroll and zoom just to read the content.

But, if you’re worried that you’ll have to do a complete rewrite of your blog’s theme to make a mobile optimized version, don’t worry, WPtouch is here to your rescue.

WPtouch is a wordpress plugin that completely changes the way your blog looks on a mobile device like the iPhone, iPod touch or the Android. In that sense, it acts more like a theme for your blog rather than a plugin.

If you’re using wordpress version 2.8 or above, the easiest method to install WPtouch is to login to the admin panel and click on the “Add New” link under Plugins.

Search for the term WPtouch and when the WPtouch plugin shows up in the search results, click on the Install link to install it automatically.

WPtouch Install

Once the installation is completed, you can activate the plugin by clicking on the Activate link on the same page.

Activate WPtouch

The plugin will now be installed and activated, ready to start serving a mobile version of your blog to your iPhone totting visitors.

If you want, you can just leave it at that and WPtouch will happily keep serving your visitors as long as you want, but if you’re like me and like to customize each and every part of your blog, I’d suggest that you give the Settings pane a look and customize certain aspects of WPtouch to better match your blog.

Click on the WPtouch link under Settings.

WPtouch Settings

This is where you can change the theme’s style, colors and the icons used. When you’re happy with your custom changes, click the Save Options button.

If you use the WP Super Cache plugin on your blog, like I do, then you need to make some more changes to the your setup.

Click on the WP Super Cache link under Settings and check the tick box that says “Mobile Device Support” and click the Update Status button.

WP Super Cache Settings

Scroll a little further down the page and you’ll find the Rejected User Agents text box. You need to add the following user agents to the list that is already there.

  • phone

  • ipod

  • android

  • dream

  • cupcake

  • webos

  • incognito

  • webmate

  • opera mini

  • blackberry9530

  • blackberry9500


Save the list.

That’s it. You can now happily declare your blog as the most mobile friendly blog in the neighborhood.
Read more…

Understanding WordPress Theme The Basics of Creating Your Own WP Theme

12:58 AM |
wordpress themeThere are a variety of free and premium WordPress themes that you can find throughout the web. You will sometime find that you can spend hours trying to modify the theme, so it is tailored to the way you want it. Sometimes it’s easier to create your own from scratch, and not deal with the headaches that can happen with customization of an existing WordPress theme. This guide will help you to understand the basic of a WordPress theme and how to create a simple theme.

I recommend that before you begin, you familiarize yourself with the WordPress file structure by analyzing as many WordPress themes as you can (Note: You need to have a basic understanding of HTML and CSS.)

Getting Started


Begin you begin coding up the theme, you must understand that the WP theme is just like any other HTML webpage, except that it is coded with PHP. Even so, you don’t need to be a PHP expert to do up a WP theme. My advice is:

  1. First get a working pure HTML page up and running (You can easily do this with a WYSIWYG webpage editor).

  2. Open the HTML webpage in a text editor and slice it up to different portion (we’ll explain more on that later)

  3. Insert in the PHP code

WordPress File Structure


The basic file structure of a WordPress theme is as follows:

  1. Style.css – The stylesheet holds all the formatting and styles of the theme

  2. Index.php – This is the main WordPress theme file that ties all the other files together

  3. Header.php – Holds all the header information. Also, if all the files were lumped together, this would be the beginning of the WordPress theme

  4. Sidebar.php – It has all the code for the sidebar

  5. Footer.php – Holds the footer code

Other files that you will also find in a WordPress theme are:

  1. Single.php – A single blog post code

  2. Comments.php – This is where you place the code to control the behavior of the blog comments

  3. Page.php - Controls the behavior of your individual pages

  4. Search.php – This is if you want to add search capability to your WordPress theme

  5. Searchform.php – Controls the way the search box behaves

  6. 404.php – Customize the landing page if your readers get an 404 error

  7. Functions.php – A way to further customize your WordPress theme

  8. Archives php – How to display the archive results

A simple layout of the theme

wordpress-theme-layout

Once you have got your HTML webpage ready, you can begin to slice up using the above layout as a guide.

To begin, you can either use an existing WordPress theme as a starting point (the WordPress default theme is a good one to start with. You don’t have to code it up from scratch, just amend the necessary stuff will do). Or, if you are adventurous, you can just start coding without one.

Main Index Template (index.php)


I suggest that you begin with Index.php because this is the file that ties all of the other WordPress files together. The first step is to call the header file. This is done by adding
<?php get_header(); ?>

The next essential piece of code you should add to the main index file is to tell WordPress how to behave if there are blog posts. This is accomplished by entering
<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

You will then enter code on how way the page will be structured. This will vary according to how you want your page to look like. For instance, magazine-type look is going to be different than a blog-type one. After entering your code, you will have to add the following lines that will tell WordPress what will happen if there are no posts:
<?php endwhile; ?>

<?php else : ?>

<?php endif; ?>

After entering the behavior of the page, you need to call the sidebar and the footer. This is done by adding the following lines of code:
<?php get_sidebar(); ?>

<?php get_footer(); ?>

On the whole, it should look like this:
<?php get_header(); ?> <!--grab the header, part 1 of the layout-->



<?php if (have_posts()) : ?> <!--displaying the main content area,  part 2 of the layout-->

    <?php while (have_posts()) : the_post(); ?>

        Your HTML code here for displaying individual post.

    <?php endwhile; ?>

<?php else : ?>

        Your HTML code here when there is no post available

<?php endif; ?>



<?php get_sidebar(); ?> <!--display the sidebar, part 3 of the layout-->

<?php get_footer(); ?> <!--display the footer, part 4 of the layout-->

Stylesheet (style.css)


The cascading stylesheet includes all the formatting and styles for your WordPress theme. This will provide more flexibility to your theme instead of hardcoding them into each individual file. It is created just like any stylesheet. If you need a refresher, check out the W3 Consortium’s CSS style guide.

Header File (header.php)


The header file is like the beginning of an HTML file. Most of the time, you can just copy and paste from the default theme. The basic code that will be in the header file is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>

<head profile="http://gmpg.org/xfn/11">

<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />

<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />

<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />

<?php wp_head(); ?>

</head>

<body>

Sidebar (sidebar.php)


The sidebar is how you want the sidebar to look like. You can have more than one sidebar. However, we are creating a simple WordPress theme, so we will stick with one. People usually like placing widgets on the sidebar, so you should add code to ensure that your WordPress theme supports widgets. You can also have any standard sidebar items that you want without having to use a widget. Sidebar basic are as follows:
<div id="sidebar">

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>

<?php endif; ?>

</div>

The code above will check if the theme supports widget. If yes, it will load all the widget content onto the template. else, nothing will show up on the template.

To widgetize your theme, simply add the following code to your functions.php
<?php  if ( function_exists('register_sidebar') )

    register_sidebar(array(

        'before_widget' => '<li id="%1$s" class="widget %2$s">',

        'after_widget' => '</li>',

        'before_title' => '<h2 class="widgettitle">',

        'after_title' => '</h2>',

    )); ?>

Footer (footer.php)


The footer file will close the WordPress theme. You can place anything you want in the footer. You will usually see the copyright information here. The basic code to create the footer file is:
<div id="footer" role="contentinfo">

        Place whatever footer information you want to place here

</div>

<?php wp_footer(); ?>

</body>

</html>

As I stated before, if you have never created a WordPress theme, but are knowledgeable in CSS and HTML, then check out the structure of existing and various other WordPress themes, and begin creating your own WordPress theme.
Read more…

My client isn't accepting my username and password

9:52 PM |
We suggest making some adjustments in your mail client's settings so you aren't always prompted to enter your username and password. Please check the following settings in your mail client:

  • Make sure that you've entered your full email address (e.g. username@gmail.com)

  • Re-enter your password to ensure that it's correct. Keep in mind that passwords are case-sensitive.

  • Make sure your mail client isn't set to check for new mail too often. If your mail client checks for new messages more than once every 10 minutes, your client might repeatedly request your username and password.


Now, please follow the steps below to resolve the problem:

  1. Open your web browser and sign in to Gmail at http://mail.google.com/mail. If you see a word verification request, type the letters in the distorted picture and finish signing in.

  2. Close your browser and try accessing your messages in your email client again.

  3. If you're still having problems, disable all mail clients you're using to read Gmail messages. (If you use one at work and one at home, please disable both.)

  4. From the computer on which your logins are failing, visit http://www.google.com/accounts/DisplayUnlockCaptcha

  5. Enter your Gmail username and password, and the letters in the distorted picture.

  6. Once you have successfully logged in, restart your mail client and try to download your mail.


If you're using a Google Apps email address, please instead follow the steps below:

  1. Open your web browser and sign in to Google Apps at http://mail.google.com/mail/a/[yourdomain]. If you see a word verification request, type the letters in the distorted picture and finish signing in.

  2. Close your browser and try accessing your messages in your email client again.

  3. Disable all mail clients you're using to read mail. (If you use one at work and one at home, please disable both.)

  4. From the computer on which your logins are failing, visit https://www.google.com/a/[your domain].com/UnlockCaptcha. Be sure to fill in your domain name in the URL.

  5. Enter your email username and password, and the letters in the distorted picture.

  6. Once you have successfully logged in, restart your mail client and try to download your mail.

Read more…

Five WYSIWYG Plugins to Enhance the WordPress Built-In Editor

12:52 AM |
wysiwyg-toolbarThe WordPress built-in editor has the minimum features to create a blog post. It’s one of the reasons that many bloggers use desktop-based blog editors that provide them with additional features that is lacking in the WordPress editor. Here are five WordPress plugins that will give you the functionality as a desktop-based editor without leaving WordPress.
Read more…

Snippet: Adding Post Thumbnail in WordPress 2.9

1:07 AM |
When surfing the Web, you can easily come across WordPress sites that associate an image thumbnail with each post. This is particularly obvious for those blog with magazine style layout. Before WordPress 2.9, the only way to do this is to insert a custom field with the URL of the image thumbnail in each post/page. Now this feature is built into the WordPress core and you can use it without using any custom field.

Firstly, in your theme folder, open the functions.php file and insert the following function to the end of the file.

if(function_exists('add_theme_support')){

add_theme_support( 'post-thumbnails' );

}

Save and upload the file back to the server.

Now in your Post/Page edit section, you will find a Set thumbnail option in the rightmost column (just below the Categories section).

wp-thumbnail

Click on it. The image uploader window will appear. You can either new image (or select from Gallery) the picture to be used as the thumbnail. Once you have uploaded, click on the use as thumbnail option.

wp-set-new-thumbnail

Save the post.

Getting the thumbnail to appear in the front end

To get the thumbnail image to appear, you need to insert the function

if ( has_post_thumbnail() ) {

// the current post has a thumbnail

} else {

// the current post lacks a thumbnail

}

in your theme files. The most likely place is index.php, single.php and page.php

Check out Mark Jaquith’s article for more detail on the usage of the thumbnail function.
Read more…

ADS