Tag Archives: wordpress

Make a mobile site for your blog in 3 steps with Google Reader

Now a days there has been a trend of accessing the web through the phone.

The reasons are:-

Its its easy as all carriers have decent data speeds and in most the browsing is free.

Ease of use as one carries the mobile phone all the time unlike a computer.

So why not convert your blog to a blog that looks great on mobile phones. To view this blog on mobile mode go to http://m.mtaram.com. For this we would be using the built in functionality of the Google Reader to render the feed for the mobile phones.

mobile blog

What you need:-

1. You blog RSS feed URL

2. Access to your Domain control panel if you are hosting your own blog. Or you can register a free domain name of the numerous sited found on Google and redirect it to your mobile blog using a free URL redirection service.

Step 1.

Login to your Domain Control Panel.

Create a sub-domain like say http://m.mtaram.com

Step 2.

Open your Blogs RSS feeds within Google Reader. The URL looks like http://www.google.com/reader/view/feed/http://feeds.feedburner.com/mmwd [the bold part is the RSS feed of my Blog via Feedburner]. You can use any RSS feed or burn your own Feed using Feedburner.

mobile view

We need to modify this URL for mobile view. To do so add a /m/ to the URL between reader and view. http://www.google.com/reader/m/view/feed/http://feeds.feedburner.com/mmwd.

Step 3.

This can be done in two ways.

First: You can permanently redirect http://m.<yourblog>.com to ">http://www.google.com/reader/view/feed/<your feed url>

Second: You can create an index.php file and specify the redirection in the index.php

Open a notepad file and copy paste the following

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: <your blog url>" );
?>

index.php

where you would be replacing <your blog url> with the modified Google Reader URL.

And you are done. Pass on the ULR of your mobile blog to your fellows and readers and enjoy.

Apart from this there is a plugin for wordpress that detects the device and renders the blog. But some how I did not like it and opted for this faster and easier method.

Post offline on wordpress with Windows live writer

live

I have been looking for a utility so that I could edit my blog offline and post whenever I went online. Then I came across Windows live writer. This is program helped me to write posts at my comfort when ever I wanted.

The program can be downloaded from Windows live website.

Installation is a breeze. Though it might take some time to download the files or you can download the full setup from the Cnet downloads.

Once installed you need to configure it for your blog. But before that you need to configure some changes on your wordpress blog to allow for remote publishing.

Go to settings >> writing and under Remote Publish allow XML – RPC

live 0

Now open windows live writer and set it up for your blog.

Go to the blogs in the Menu bar and click Add Blog Account

Select the other blog service option.

live 1

Enter your Blog url, username and password. And if you don’t want to enter the password again and again, check remember password.

live 2

Live writer will Analyze the blog detect the theme and you are done.

live 3

After this the application asks you to enter your Blogs name and Finish. And you are ready to make your posts.

live4

Arkayne’s plugin for bloggers

http://a1.twimg.com/profile_images/398388812/ArkayneFavicon_bigger.jpgArkayne delivers relevant links at the bottom of your content. Whether that content is a blog post, news article or any other form of textual information, Arkayne examines every viewable word on the page and then searches your site, sites within your network, and the web for the most contextually relevant matches.

Arkayne does what other related content plugins don’t:

  • Allow your friends to recommend your relevant blog posts.
  • Show more of your posts in your RSS feeds.
  • Introduce you to other bloggers in the same space.
  • Deliver high CTR rates that increase your audience.

This vdo from their website shows how it works.

We installed this plugin yesterday and registered with their network. The concept of recommending the blogs on the newtork is great. We are still lookin out how it can benefit our websites and would be posting more about Arkayne in near future.

WordPress plugins that make our blog cool

WordPress is a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability.

http://www.alleba.com/blog/wp-content/uploads/2008/09/wordpress-plugin-2.jpg

Plugins can extend WordPress to do almost anything you can imagine.We have tried numerous plugins. Some were too good, some crappy, some very useful and some totally annoying. After installing, editing, deleting and reinstalling we are left with the following cool plugins which provide our readers with the wonderful reading exprience.

About the Author Box

Visit plugin site

Displays a sleek “about the author” box in the single posts page. This is very useful for team blog having too many writers.

about the autjor

All in One Adsense and YPN

Visit plugin site

Inserts Adsense or YPN code in to your blog posts. Ad position can be random or pre-defined.

adsense

All in One SEO Pack

Visit plugin site

Out-of-the-box SEO for your WordPress blog.

Arkayne Plugin

Visit plugin site

First, if you have not already done so, create an Arkayne account. Second, paste the token you were given by Arkayne into the Arkayne Setup admin page. As people visit more of your pages Arkayne will build links.

you are social

Best Related Posts

Visit plugin site

Shows related posts with thumbnails. Allows you to design your own layout using simple interface.

best related posts

FaceBook Share (New)

Visit plugin site

Adds a button which allows you to share post and also shows the number of times the post or page has been shared through out the Facebook just like tweetmeme button does for twitter.

fbshare

FeedBurner FeedSmith

Visit plugin site

Originally authored by Steve Smith, this plugin detects all ways to access your original WordPress feeds and redirects them to your FeedBurner feed so you can track every possible subscriber.

FollowMe

Visit plugin site

WP FollowMe is a wordpress plugin that allow you to add a twitter Follow me badge on your wordpress blog.

followme

Google XML Sitemaps

Visit plugin site

This plugin will generate a special XML sitemap which will help search engines like Google, Yahoo, Bing and Ask.com to better index your blog.

GZIP Output

Visit plugin site

Allow GZIPped output for your WordPress blog. Restores functionality removed in WordPress 2.5.

My Page Order

Visit plugin site

My Page Order allows you to set the order of pages through a drag and drop interface. The default method of setting the order page by page is extremely clumsy, especially with a large number of pages.

New User Email Setup

Visit plugin site

A Plugin to setup the registration email sent to new users. REQUIRES PHP 5

Online Leaf

Visit plugin site

Changing the standards of websites’ energy consumption is a big task, so we need all the help we can to spread the message.

Popularity Contest

Visit plugin site

This will enable ranking of your posts by popularity; using the behavior of your visitors to determine each post’s popularity. You set a value (or use the default value) for every post view, comment, etc. and the popularity of your posts is calculated based on those values. Once you have activated the plugin, you can configure the Popularity Values and View Reports. You can also use the included Widgets and Template Tags to display post popularity and lists of popular posts on your blog.

popularity contest


Post Layout

Visit plugin site

Adds HTML or javascript code before, after or in the middle of the content of pages or posts without modify the theme.

Redirection

Visit plugin site

Manage all your 301 redirects and monitor 404 errors

redirection

SexyBookmarks

Visit plugin site

SexyBookmarks adds a (X)HTML compliant list of social bookmarking icons to each of your posts. See configuration panel for more settings.

sexybm

Smart Video

Visit plugin site

Plugin to insert videos from Youku, Tudou, QQ Video and some other online video sites (mainly supporting chinese sites).

TweetMeme Retweet Button

Visit plugin site

Adds a button which easily lets you retweet your blog posts.

tweetmeme

Ultimate Google Analytics

Visit plugin site

Enable Google Analytics on your blog. Has options to also track external links, mailto links and links to downloads on your own site.

Weasel’s HTML Bios

Visit plugin site

Disables the HTML-tag-stripping of author bios.

WordPress.com Stats

Visit plugin site

Tracks views, post/page views, referrers, and clicks. Requires a WordPress.com API key.

stats

WordPress Mobile Edition

Visit plugin site

Show your mobile visitors a site presentation designed just for them. Rich experience for iPhone, Android, etc. and clean simple formatting for less capable mobile browsers. Cache-friendly with a Carrington-based theme, and progressive enhancement for advanced mobile browsers.

WP-Cumulus

Visit plugin site

Flash based Tag Cloud for WordPress

WP Greet Box

Visit plugin site

Show a different message to your visitor depending on which site they are coming from. For example, you can ask Digg visitors to Digg your post, Google visitors to subscribe to your RSS feed, and more! Best of all, this plugin is compatible with various WordPress cache plugins.


WP Super Cache

Visit plugin site

Very fast caching plugin for WordPress.

About the Author Box

Visit plugin site

Displays a sleek “about the author” box in the single posts page. This is very useful for team blog having too many writers.

All in One Adsense and YPN

Visit plugin site

Inserts Adsense or YPN code in to your blog posts. Ad position can be random or pre-defined.

All in One SEO Pack

Visit plugin site

Out-of-the-box SEO for your WordPress blog.

Arkayne Plugin

Visit plugin site

First, if you have not already done so, create an Arkayne account. Second, paste the token you were given by Arkayne into the Arkayne Setup admin page. As people visit more of your pages Arkayne will build links.

Best Related Posts

Visit plugin site

Shows related posts with thumbnails. Allows you to design your own layout using simple interface.

FaceBook Share (New)

Visit plugin site

Adds a button which allows you to share post and also shows the number of times the post or page has been shared through out the Facebook just like tweetmeme button does for twitter.

FeedBurner FeedSmith

Visit plugin site

Originally authored by Steve Smith, this plugin detects all ways to access your original WordPress feeds and redirects them to your FeedBurner feed so you can track every possible subscriber.

FollowMe

Visit plugin site

WP FollowMe is a wordpress plugin that allow you to add a twitter Follow me badge on your wordpress blog.

Google XML Sitemaps

Visit plugin site

This plugin will generate a special XML sitemap which will help search engines like Google, Yahoo, Bing and Ask.com to better index your blog.

GZIP Output

Visit plugin site

Allow GZIPped output for your WordPress blog. Restores functionality removed in WordPress 2.5.

My Page Order

Visit plugin site

My Page Order allows you to set the order of pages through a drag and drop interface. The default method of setting the order page by page is extremely clumsy, especially with a large number of pages.

New User Email Setup

Visit plugin site

A Plugin to setup the registration email sent to new users. REQUIRES PHP 5

Online Leaf

Visit plugin site

Popularity Contest

Visit plugin site

This will enable ranking of your posts by popularity; using the behavior of your visitors to determine each post’s popularity. You set a value (or use the default value) for every post view, comment, etc. and the popularity of your posts is calculated based on those values. Once you have activated the plugin, you can configure the Popularity Values and View Reports. You can also use the included Widgets and Template Tags to display post popularity and lists of popular posts on your blog.

Post Layout

Visit plugin site

Adds HTML or javascript code before, after or in the middle of the content of pages or posts without modify the theme.

Redirection

Visit plugin site

Manage all your 301 redirects and monitor 404 errors

SexyBookmarks

Visit plugin site

SexyBookmarks adds a (X)HTML compliant list of social bookmarking icons to each of your posts. See configuration panel for more settings.

Smart Video

Visit plugin site

Plugin to insert videos from Youku, Tudou, QQ Video and some other online video sites (mainly supporting chinese sites).

TweetMeme Retweet Button

Visit plugin site

Adds a button which easily lets you retweet your blog posts.

Ultimate Google Analytics

Visit plugin site

Enable Google Analytics on your blog. Has options to also track external links, mailto links and links to downloads on your own site.

Weasel’s HTML Bios

Visit plugin site

Disables the HTML-tag-stripping of author bios.

WordPress.com Stats

Visit plugin site

Tracks views, post/page views, referrers, and clicks. Requires a WordPress.com API key.

WordPress Mobile Edition

Visit plugin site

Show your mobile visitors a site presentation designed just for them. Rich experience for iPhone, Android, etc. and clean simple formatting for less capable mobile browsers. Cache-friendly with a Carrington-based theme, and progressive enhancement for advanced mobile browsers.

WP-Cumulus

Visit plugin site

Flash based Tag Cloud for WordPress

WP Greet Box

Visit plugin site

Show a different message to your visitor depending on which site they are coming from. For example, you can ask Digg visitors to Digg your post, Google visitors to subscribe to your RSS feed, and more! Best of all, this plugin is compatible with various WordPress cache plugins.

WP Super Cache

Visit plugin site

Very fast caching plugin for WordPress.

Add Prev Next post link to wordpress blog

Some of the themes of wordpress dont come with previous/next post links when viewed in single post mode. This can be quite frustrating for the readers [it sure was for me]. My theme is “Magazine Basic” and it doesnt have previous/next post links.

To add these links to my theme I tried Bobs simple navigation plugin. But the issue with this plugin is that, It just displays the post title as a link confusing the users what that link is about. There is a hover feature that tell the link details but it take more than 2-3 seconds to be visible.

I tried a lot and ultimately found the solution here. I did a little customizations. Following are the steps how to go about it along with my customizations.

First you need to have access to the directory which holds your wordpress files.

Navigate to <blog dir>/wp-content/themes/<your theme>/single.php

and edit it. Add the follwing code where you want it to be visible. I added it twice to make it appear at top and bottom of the post.

wp link

<?php if($single) { ?>
<div>
<span><?php previous_post('&lsaquo;&lsaquo;&lsaquo; %', 'Previous Post', 'no', 'no'); ?></span>
<span><?php next_post('% &rsaquo;&rsaquo;&rsaquo;', 'Next Post', 'no', 'no'); ?></span>
</div>
<?php } ?>

This would just show the text you want to display for the links.

top

<?php if($single) { ?>
 <div>
 <span><?php previous_post('&lsaquo;&lsaquo;&lsaquo;  %', 'Previous Post', 'yes', 'no'); ?></span>
 <span><?php next_post('% &rsaquo;&rsaquo;&rsaquo;',  'Next Post', 'yes', 'no'); ?></span>
 </div>
 <?php } ?>

This would show the name of the post too along with the text.

bottom

As you can see both links are differently styled… It depends upon the style defined for that region in the css.

One last step.

The above code wont show any results unless you define the details in the css file located at Navigate to

<blog dir>/wp-content/themes/<your theme>/styles.css

Edit this file and add

.nextprev {
 height: 1.5em;
}
.nextprev .prev {
 float: left;
}
.nextprev .next {
 float: right;
}

WordPress Tricks to Improve Your Blog

Build a Featured Posts Section for WordPress

Magazine themes are becoming increasingly popular. There are plenty of quality premium themes available, and also some decent free magazine themes, but you may want to build or customize your own. This tutorial covers the process of coding the index.php file to set up a magazine-style front page with a featured post section.

Featured Post Section

WordPress Sidebar Turned Apple-Flashy Using jQuery UI

Sidebars are often pretty boring. If you’re looking to improve yours, this tutorial goes through the process of using jQuery that expands and reacts to user actions, similar to the Apple sidebar.

Flashy Sidebar

How to Make a Featured Post Carousel for WordPress

This tutorial will show you a different approach to displaying featured content. The technique is fairly simple, and can easily be applied to any blog that wants to give more exposure to certain content. This only requires a few coding changes to get the featured content in the carousel.

Featured Post Carousel

Building a Better Blogroll: Dynamic Fun with SimplePie and jQuery

This tutorial from Chris Coyier is not exclusively for WordPress, but this could easily the sidebar for many WordPress users. Blogrolls are common sidebar features, but with this tutorial Chris shows how the traditional blogroll can be taken a step further by bringing in feeds from other sites and blogs using SimplePie and jQuery. This technique is especially useful for those who run multiple blogs or a network.

Build a Better Blogroll

Dynamic Highlight Menu

Nick La of Web Designer Wall has a post with a number of WordPress hacks, one of them being the dynamic highlight menu. Nick shows his approach for creating the navigation menu at Best Web Gallery that highlights the current location for visitors.

Dynamic Highlight Menu

Two-Tiered Conditional Navigation

In this tutorial Darren Hoyt provides the code for creating a WordPress navigation menu that shows both parent pages and the relevant child pages. For sites and blogs that have a lot of content and pages, this trick can help to improve user experience.

Two-Tiered Conditional Navigation

WordPress Custom Fields: Laying Text Over Your Lead Graphic

WordPress’s custom fields open up endless possibilities for theme developers and bloggers.  In this tutorial you’ll learn how to use custom fields to display an image for a post with text laying on top of it.

Laying Text Over Lead Graphic

“Magazine-Style” Horizontal Dropdown Menu

Jean-Baptiste Jung shows another technique for improving the navigation of a WordPress site. The horizontal dropdown menu uses categories and sub-categories to create a magazine-style nav menu.

Horizontal Dropdown Menu

Integrate a Slideshow into Your WordPress Theme

Smooth Gallery is a MooTools gallery that can add some sizzle to a website. In this tutorial you’ll learn how to integrate Smooth Gallery with WordPress.

Integrate a Slideshow

Adding Tabs to Your Blog Sidebar

If you’d like to improve your sidebar by adding some tabbed content/navigation areas, this tutorial covers the process of using Yahoo! TabView in your WordPress sidebar.

Adding Tabs to Your Sidebar

Create a “Send This to Twitter” Button

As Twitter continues to increase in popularity, integrating Twitter and WordPress will likely continue to become more common. This post isn’t really a tutorial, but it does give the code that you need to add a “send this to Twitter” link or button to your WordPress blog.

Send This to Twitter Button

Plugins:

J Post Slider Plugin

With the J Post Slider Plugin gives WordPress users an easy way to add an attractive image slide show that can be controlled from the admin panel.

J Post Slider Plugin

Lightview for WordPress

Lightview is similar to Lightbox. However, Lightview also works with videos and iframed web pages in addition to photos.

Lightview for WordPress

NextGEN Gallery

NextGEN Gallery is a full integrated Image Gallery plugin for WordPress with a Flash slideshow option.

NextGEN Gallery

Advanced Category Excluder

Advanced Category Excluder allows WordPress users to easily have CMS-like control over which content appears on the front page, in RSS feeds, archives and more.

Advanced Category Excluder

Event Calendar 3

With Events Calendar 3 you can manage future events as an online calendar. Display upcoming events in a dynamic calendar, on a listings page, or as a list in the sidebar.

Events Calendar 3

WP e-Commerce

WP e-Commerce is a highly useful plugin for bloggers or website owners who want to sell products from their site without a lot of work to set up an e-commerce site.

WP e-Commerce Plugin

TDO Mini Forms

With TDO Mini Forms you can allow users to submit posts by completing a form. The posts are held in moderation until you choose to publish them.

TDO Mini Forms

FV Community News Plugin

Community news sections are popular among design blogs. This plugin will make it easy to accept and publish user submissions. There are a lot of options and control for the site owner or administrator.

FV Community News Plugin

Yoast Breadcrumbs

Breadcrumb navigation can be helpful for usability and SEO purposes. This plugin allows you to easily add plugins to your WordPress theme.

15 Killer Hacks for WordPress that Are Extremely Useful

1. Link to External Sources from Your Post Title

Often it is the case where blogger wants to just link to an external resource because he/she finds it useful to their readers. The main problem they face is that they have to make a new post in order to just tell the readers to go to another site. In this Custom Field Hack we will show you how you can link to an external link from your post title.

First thing you need to do is open your functions.php which is found in your template folder where other files like single.php and page.php is located. Paste the following code:

function print_post_title() {
global $post;
$thePostID = $post->ID;
$post_id = get_post($thePostID);
$title = $post_id->post_title;
$perm = get_permalink($post_id);
$post_keys = array(); $post_val = array();
$post_keys = get_post_custom_keys($thePostID);

if (!empty($post_keys)) {
foreach ($post_keys as $pkey) {
if ($pkey==’url1′ || $pkey==’title_url’ || $pkey==’url_title’) {
$post_val = get_post_custom_values($pkey);
}
}
if (empty($post_val)) {
$link = $perm;
} else {
$link = $post_val[0];
}
} else {
$link = $perm;
}
echo ‘<h2><a href=”’.$link.’” rel=”bookmark” title=”’.$title.’”>’.$title.’</a></h2>’;
}

Now you would need to open your index.php and find the following code or something similar:

<h2><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></h2>

Change it to:

<?php print_post_title(); ?>

Once you have done that, upload both files to your webhost.

Now when you are writing a post, scroll down to where it says Custom Fields. Find the name: url1, title_url, or url_title and add the url to the external resource. Add a short description if you so desire, and hit publish.

Don’t be afraid, this function does not take away your normal post title links, all it does is add an extra query which checks for custom field for external links. If the external link is not included, it refers to the default code and link to the normal post page

There is also a plugin that does this job. It is called Page Links To

2. Change the Default Gravatar for Comments

Good Bye Mystery Man

The default mystery man is really annoying for most users. Plus if you have one more chance of branding your blog, then why not do it. Changing your default gravatar lets you brand your blog more. With this snippet below you can change your default gravatar.

First you need to open your functions.php which is located in your template folder. If you don’t have one then create one and insert the following code:

add_filter( ‘avatar_defaults’, ‘newgravatar’ );

function newgravatar ($avatar_defaults) {
$myavatar = get_bloginfo(‘template_directory’) . ‘/images/gravataricon.gif’;
$avatar_defaults[$myavatar] = “WPBeginner”;
return $avatar_defaults;
}

In the code the image is being extracted from the theme directory and it is called gravataricon.gif obviously you will change it to your image name. Where it says WPBeginner, that is the name of the avatar of how it will show in your admin panel options area.

Gravatar Settings

Head over to your admin panel and click Settings > Discussion and change the icon, and now you have a branded comment area with your logo.

3. Display a Retweet Button with your Brand

Add a Retweet button in WordPress

With Twitter getting so much exposure, as a blogger you should already be using it to your advantage. Power of twitter is like no other because it is word of mouth advertising. To make this easier on your readers, what you can do is place a prominent retweet button, so they can retweet the article with one click. Not only just that, but you should make it the way so you can track the retweets as well. That is where tweetmeme widget comes in.

In this tutorial we will have you create a button that will link to the text in the following format:

RT @yoursitename Title of the Post – Link

Add the following code in the template file of your choosing most likely single.php

For the Large Button:

<script type=”text/javascript”>
tweetmeme_source = ‘wpbeginner’;
</script>
<script type=”text/javascript” src=”http://tweetmeme.com/i/scripts/button.js”> </script>

For the Compact Button:

<script type=’text/javascript’>
tweetmeme_style = “compact”;
tweetmeme_source = ‘wpbeginner’;
</script>

Remember to change the source to your twitter account name, this way you will not only promote your account to get more followers, but your article will be promoted as well.

4. Display Random Header Images on Your Blog

Random Header Images

Most blog designs get boring if they have a huge header picture and it is static. This is when this tutorial comes in to make your header images dynamic because it rotates on each visit. You can select as many images as you want to rotate randomly. It brings life to a blog.

First you need to name your images in this format:

  • headerimage_1.gif
  • headerimage_2.gif
  • headerimage_3.gif

You must separate the name with an underscore. You can change the headerimage text to himage or anything you like.

Once you have done that paste the following code in your header.php where you would like the images to be displayed or in any other file.

<img src=”http://path_to_images/headerimage_<?php echo(rand(1,3)); ?>.gif”
width=”image_width” height=”image_height” alt=”image_alt_text” />

Make sure that you change the number 3 if you decide to do more than 3 images. This code is not exclusive for WordPress, it will work with any php based platform.

5. Control When Your Posts are Available Via RSS

Control When Your Posts are Available Via RSS

There are times when you publish a post and suddenly find an error. You can go back in the admin panel and change it, but it is already published in the feeds. With this hack, you can put a delay of as many minutes as you like, so you can double check the post live.

Open your functions.php and add this code:

function publish_later_on_feed($where) {
global $wpdb;

if ( is_feed() ) {
// timestamp in WP-format
$now = gmdate(‘Y-m-d H:i:s’);

// value for wait; + device
$wait = ‘10′; // integer

// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
$device = ‘MINUTE’; //MINUTE, HOUR, DAY, WEEK, MONTH, YEAR

// add SQL-sytax to default $where
$where .= ” AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, ‘$now’) > $wait “;
}
return $where;
}

add_filter(‘posts_where’, ‘publish_later_on_feed’);

This code is adding a 10 minute delay on your post being shown on the RSS Feeds, you can change it by changing the number 10 to as many minutes as you like.

6. Display Certain Categories in a Menu

Display Certain Categories in a Menu

In many cases, users only want to display certain categories in their navigation menu at the top of the page. There are limited spots, that can only be filled by top categories, but if you use the default wp_list_categories code, it will show all categories. This is why this hack below comes in very handy when you want to create a navigation menu and only display certain categories.

<ul style=”float:left; width:730px;”>
<?php wp_list_categories(‘orderby=name&include=7,9,19,16,1,5,17,23’); ?>
</ul>

Note, you can also change the ‘include’ text to ‘exclude’ and show all categories and exclude those that you don’t want displayed. The numbers displayed in the code are the category IDs. Remember since WordPress shows categories in a list format, you will need to edit the CSS in order to make it work.

7. Separate TrackBacks from Comments

Separate TrackBacks from Comments

When you write a great post on your blog, it likely to be linked from all around the blogosphere. At the same time most great posts start a good discussion in the comments. If you don’t separate your trackbacks from comments, it is very hard for your users to follow the comments and the discussion. In this hack we will show you how you can separate trackbacks from comments.

First you need to open comments.php and find a loop that looks something like this:

foreach ($comments as $comment) : ?>
// Comments are displayed here
endforeach;

Replace it with:

<ul>
<?php //Displays comments only
foreach ($comments as $comment) : ?>
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type == ‘comment’) { ?>
<li>//Comment code goes here</li>
<?php }
endforeach;
</ul>

<ul>
<?php //Displays trackbacks only
foreach ($comments as $comment) : ?>
<?php $comment_type = get_comment_type(); ?>
<?php if($comment_type != ‘comment’) { ?>
<li><?php comment_author_link() ?></li>
<?php }
endforeach;

</ul>

Basically this list is telling WordPress to display the comments in two list. If it is a Trackback display it separately and if it is a normal comment display it separately.

8. How to List Future “Upcoming” Posts

List Future Scheduled Posts

Everyone wants more users to subscribe to their feeds. The way to get more users excited and interested in your blog is to show them the future blog posts that you have scheduled.

First you need to schedule your posts for the future dates. Then open your sidebar.php or wherever you like to display the list of future posts, and paste the following code:

<?php query_posts(‘showposts=10&post_status=future’); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<span><?php the_time(‘j. F Y’); ?></span></p>
<?php endwhile;
else: ?><p>No future events scheduled.</p>
<?php endif; ?>

The code above is being sorted by the parameter post_status which in this case is “future”, but it can be draft, published and so on. There is also another parameter in this post that limits the number of posts being displayed, showposts=10. You can change the number to however many schedule posts you want to show your users.

9. Display Thumbnails Next to Each Post

Display Thumbnails Next to Each Post

Picture speaks thousand words. We have heard that saying before, and it is true with blogs also. You can’t possibly describe the post enough in a short excerpt, but adding an image brings life to the post and make the user want to click even more. With this custom field hack, we will show you how you can do just that.

First you need to make a default image of a size 210 x 210px which is what we are using at WPBeginner. You can name this default image defaultimage.gif or in this example we are using wpbeginner.gif and make sure you upload it to your theme directory folder.

Then you need to open your index.php and paste the following code where you want the image to be displayed.

<?php $postimageurl = get_post_meta($post->ID, ‘post-img’, true);
if ($postimageurl) {
?>
<a href=”<?php the_permalink(); ?>” rel=”bookmark”><img src=”<?php echo $postimageurl; ?>” alt=”<?php the_title(); ?>” width=”210″ height=”210″ /></a>
<?php } else { ?>
<a href=”<?php the_permalink(); ?>” rel=”bookmark”><img src=”<?php bloginfo(‘template_url’); ?>/images/wpbeginner.gif” alt=”<?php the_title(); ?>” width=”210″ height=”210″ /></a>
<?php } ?>

10. Set an Expiration Date for Your Posts

Set an Expiration Date for Your Posts

This hack comes becomes very useful when you are running a contest because you might be posting information such as clues or hints that you don’t want to stay up for ever. Instead of manually removing the article, you can just make it expire automatically. It also works if you have a product that you are offering a discount on. You posted it on your blog, but you don’t want that discount to stay on your blog after its over. So you can remove it automatically with this code.

All you need to do is replace your WordPress Loop with this code:

<?php
if (have_posts()) :
while (have_posts()) : the_post(); ?>
$expirationtime = get_post_custom_values(‘expiration’);
if (is_array($expirationtime)) {
$expirestring = implode($expirationtime);
}

$secondsbetween = strtotime($expirestring)-time();
if ( $secondsbetween > 0 ) {
// For example…
the_title();
the_excerpt();
}
endwhile;
endif;
?>

Once you have done that, you can use custom fields when writing a post to set an expiration date. Make sure you select the key “expiration” and use the the following date format: mm/dd/yyyy 00:00:00

Now this hack does not remove or unpublish the article instead it just excludes the article from being displayed in the loop.

11. Delete Batches of Post Revisions

Delete Batches of Post Revisions

WordPress has a lot of good features and one of them is Post Revisions. This was included in WordPress 2.6, even though this is a good feature, it can cause some problems. One of them is increase the size of your database. Depending on how long it takes you to write a post, you might have as many as fifty post revisions. Now you can manually delete them, or you can run a simple query which we will show you in this post and get rid of all these useless revisions.

First thing you need to do is login to your phpMyAdmin and select your WordPress Database.

Click on the SQL Button and enter the following query:

DELETE FROM wp_posts WHERE post_type = “revision”;

In this code basically we looked up a table wp_posts and removed every post that had a post_type revision associated with it. Now depending on the size of your database, this may save you a lot of space.

12. Display Any RSS Feed on Your Blog

Display Any RSS Feed on Your Blog

There are often times when bloggers want to display RSS Feeds of other sites on their blog. Maybe it is from another blog of theirs that is related. This is when this hack comes handy because it makes your job much easier. There are several scripts and plugins that will do it for you, but you don’t need those because WordPress has this feature built in. And you should know that because you see the feeds in your Admin Panel Dashboard.

All you have to do is paste the following code where you want the feeds to be displayed. Most commonly placed in sidebar.php:

<?php include_once(ABSPATH.WPINC.’/rss.php’);
wp_rss(‘http://feeds2.feedburner.com/wpbeginner’, 5); ?>

Save the file and Upload it and you are done.

The function we used in this hack wp_rss is built in WordPress for future reference.

13. Display “Digg This” Button on Specific Posts with One Click

Display Digg This Button in Specific Posts

Digg Button in the article is very helpful specially when you article is submitted on digg. But you should not put the digg this button in every post because not every post is meant for digg. For example, if you post an announcement that you will be changing your theme, it does not need to be submitted on digg. This is when this hack comes in where you can just use the custom fields to display the “Digg This” Button in articles that you want.

Add this code in single.php where you want it displayed:

<?php $cf = get_post_meta($post->ID, ‘digg’, true);
if (!emptyempty($cf)) {
echo ‘http://digg.com/tools/diggthis.js” type=”text/javascript”>’} ?>

Now when you create a post use the custom field “Digg” and set any value and it will show the digg field. And if you don’t add that custom field, it will not show. Simple and easy.

14. Display Sticky Posts in One Area

Display Sticky Posts in One Area

This feature was wanted by many users therefore it was included in WordPress. Now in this hack we will show you how you can list all your sticky posts as a featured post in your home page or any other page.

<?php
$sticky = get_option(‘sticky_posts’);
rsort( $sticky );
$sticky = array_slice( $sticky, 0, 5);
query_posts( array( ‘post__in’ => $sticky, ‘caller_get_posts’ => 1 ) );

if (have_posts()) :
while (have_posts()) : the_post();
the_title();
the_excerpt();
endwhile;
endif;

?>

You can change the number 5 the amount of posts you want to show in your page. You can also display full posts by changing ‘the_excerpt’ value to ‘the_content’.

15. Display Ads after the First Post

Adding an ad after the post can get you really good money because advertisers really like that spot. It is one of the hot advertising spots. You can even place adsense there. But if you place as a normal code, an ad will be shown after each post which gets annoying for your users. Therefore using this hack, you can display ads after the first post.

Replace your current loop with this hacked version of the loop in your index.php

<?php if (have_posts()) : ?>
<?php $count = 0; ?>
<?php while (have_posts()) : the_post(); ?>
<?php $count ; ?>
<?php if ($count == 2) : ?>
//Paste your ad code here
<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php else : ?>
<h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>

Now this code will show the ad after your second post. Make sure you insert your ad codes there.