Creative Farm Design Running list of Snippet (work in progress)
http://codex.wordpress.org/
Menu List
List Page Syntax
http://codex.wordpress.org/wp_list_pages
http://wpcandy.com/articles/tutorials/the-wordpress-help-sheet.html
http://www.hongkiat.com/blog/40-most-wanted-wordpress-tricks-and-hacks/
40+ Most Wanted Wordpress Tricks and Hacks

Don’t miss any post. Subscribe to Hongkiat’s RSS feed now.
Have you ever came across a Wordpress blog, saw something you liked, and questions like ‘how they did that‘, ‘is that a plugin or hack?‘, ‘where can I get those cool mods‘ begin to pop? Well, it’s really pretty normal because most of us did the same thing. For this article we’ve spent time with some 14 Wordpress bloggers, finding out what kinda hacks and plugins they are really looking for to enhance their blog in any aspect. Here’s our outcome, 40+ most wanted Wordpress tips and hacks, including those you don’t even knew the keywords to search for.
While you are at it, here’s few more Wordpress related articles we’ve previously written:
- 49 Most downloaded Wordpress themes
- Wordpress themes for Video Blogging
- 20 Desktop blogging clients
- 16 Wordpress premium themes that don’t suck
-
Display categories in horizontal Drop-Down menu
Instead of using your categories in sidebar, you can put them up on the navigation bar, dropping down the sub categories in second-level drop down.
-
Add Gravatar for post author
How about adding Gravatar to your post titles to highlight the comment author?
-
Using custom page as homepage
Instead of showing recent entries as main page on your blog, customize it!
-
Add author bio on every blog post
For multi-authored blogs, adding the bio info of each author at the bottom of their respective posts is a good way to give props to the author as well as providing information to the readers as to who that person is without having to refer to an about me page.
-
Display recent post from specific category
Control recent post of any categories you want to display.
-
Highlight author’s comments
This helps differenciate the author’s comments away from the rest. Useful for commentators to spot which are comments made by the author.
-
Create thumbnails for each blog post and displays them
How to create thumbnails for each blog post, use them anywhere you want, make your post more interesting.
-
Create and show categories image
How to add some simple PHP code to your Wordpress template and make linked images appear instead of text for your categories in posts.
-
Format images for feed readers
Get your blog content to display properly, even in feeds.
-
Create really cool Wordpress date button
Display your blot post’s date in the form of button.
-
Hiding Advertisements For Single Posts
Quick and easy way to hide advertisements for any particular post by making some minor changes to your theme.
-
Creating a dynamic sticky
There are some news you just want them to stay on top.
-
Customize Error 404 page
Create a new Error 404 page of your own.
-
Protect CSS Mods for ANY WordPress Theme
Implementing a custom stylesheet that simply overrides the styles defined in the theme’s original stylesheet
-
Make your blog Digg proof
Tweaks and settings to add to your blog to take the Digg effect.
-
Using Wordpress as Membership Directory
Create a moderated membership directory that showcases your member’s information.
-
4 Ways to speed up your wordpress blog
Some quick tips on how to speed up your self-hosted WordPress site.
-
Create mobile version of your blog
Create a mobile version of the website within clicks with Mofuse.
-
Open links in new windows (by default)
Title’s pretty self-explainatory, make all links open in new window.
-
Turn Wordpress blog into CMS (Content Management System)
Your Wordpress blog don’t have to look like a typical blog display. It can be something more fun.
-
WordPress Thumbnail Size Limit Hack
Don’t like the default thumbnail JPEG quality? Change it.
-
Automatically post Del.icio.us daily link to Wordpress
Get more daily post on blog, from del.icio.us
-
Create a peel away effect on blog
Very effective way to market products and bring more attention to pages you want visitors to focus.
-
Seperate Comments from Trackbacks/Pingbacks
Get a clear view on what are comments, what’s not.
-
Blog Alone or Together with Writely
Writely is one of my favorte Web 2.0 apps. It’s a full-fledged web-based word processor that you can access from anywhere. Think of it as Microsoft Word for the Web.
-
Embed Google Ad in first wordpress post
The leading SEO (Search Engine Optimization) sites will tell you that placing an ad after the first post in your blog’s home page is particularly effective.
-
Creating multiple single posts for different categories
Fast and simple way to assign a specific stylesheet for only one category of blog posts in a WordPress blog.
-
Using WordPress Custom Fields
You can do pretty much anything you want with custom fields. Your imagination is your limit.
-
Creating an Archive Index
Create single page with links to all your archived entries, arranged just so to form the main gateway into your blog’s past.
-
Wicked WordPress Archives in One Easy Step
Provide specialized archive views that place a premium on scannability.
-
Place a login form in the sidebar
Put a login on the front page of your Wordpress blog.
-
Protect Wordpress post againts hot-linking
Plugin for Wordpress that helps prevent image hotlinking as easy as installing and activating it.
-
Moving a Static HTML Site to WordPress
how you retain the old URLs after moving static HTML to Wordpress.
-
Build a Techmeme River of News Clone
Building something similar to Techmeme with Wordpress.
-
Custom login page
This is more significant for multi author blogs, or sites you have set up for clients.
-
How to Put Your Best Content Forward
Don’t let your best content get lost in the archives.
-
Display Twitter messages in Wordpress
Cuztomize the Twitter message display on your Wordpress blog.
-
Add Stripe Ad to boost response / earnings
A new non-obtrusive way of displaying a single line of advertising message, a special note or other information right at the top of your blog
-
How to Display Facebook Statuses on Wordpress Blog
Put your Facebook statuses directly on your wordpress blog. Works for both self-host Wordpress and Wordpress.com bloggers.
-
Post text and image count
Counts and display number of words and images (leaving the default Wordpress smilies out)
-
Place content only in RSS Feed
Ever wonder how some bloggers control some content to be shown only in RSS feed but not the blog. Here’s the plugin to do that – RSS Footer.
Read also: 40+ Most Wanted Wordpress Tricks and Hacks
http://www.webdesignerwall.com/tutorials/wordpress-theme-hacks/
WordPress Theme Hacks
WordPress was originally created as a weblog or blog platform. But now WordPress has grown so powerful that you can use it to create any type of website and use it as a Content Management System (CMS). In this article, I’m going to share some of my WordPress tricks with you on how to make a better WordPress theme. I’m not a programmer nor developer, so I will focus more on the frontend development. Oh yeah, I forgot to mention that WordPress has made it so easy that even a non-programmer (designer like me) can build a wonderful website. My WordPress sites included: N.Design Studio, Best Web Gallery, Web Designer Wall, and some free WordPress Themes.
WordPress Conditional Tags
Conditional Tags are very useful when creating a dynamic WordPress theme. It allows you to control what content is displayed and how that content is displayed. Here are couple sample uses of Conditional Tags:
Dynamic Highlight Menu
Here is what I used to create a dynamic highlight menu on Best Web Gallery. In the first list item, if it is Home or Category or Archive or Search or Single, add class=”current” to the <li> tag, which will highlight the “Gallery” button. Second item, if it is page with Page Slug “about”, add class=”current”.
<ul id="nav">
<li<?php if ( is_home() || is_category() || is_archive() || is_search() || is_single() || is_date() ) { echo ' class="current"'; } ?>><a href="#">Gallery</a></li>
<li<?php if ( is_page('about') ) { echo ' class="current"'; } ?>><a href="#">About</a></li>
<li<?php if ( is_page('submit') ) { echo ' class="current"'; } ?>><a href="#">Submit</a></li>
</ul>
Dynamic Title tag
Again, I use Conditational Tags to output dynamic <title> tag in the header.php.
<title>
<?php
if (is_home()) {
echo bloginfo('name');
} elseif (is_404()) {
echo '404 Not Found';
} elseif (is_category()) {
echo 'Category:'; wp_title('');
} elseif (is_search()) {
echo 'Search Results';
} elseif ( is_day() || is_month() || is_year() ) {
echo 'Archives:'; wp_title('');
} else {
echo wp_title('');
}
?>
</title>
Dynamic Content
If you want to include a file that will only appear on the frontpage, here is the code:
<?php if ( is_home() ) { include ('file.php'); } ?>
Feature post highlighting
Let’s say categoryID 2 is your Feature category and you want to add a CSS class to highlight all posts that are in Feature, you can use the following snippet in The Loop.
<?php if ( in_category('2') ) { echo ('class="feature"'); } ?>
Unique Single template
Suppose you want to use different Single template to display individual post in certain category. You can use the in_category to check what category is the post stored in and then use different Single template. In your default single.php, enter the code below. If the post is in category 1, use single1.php, elseif in category 2, use single2.php, otherwise use single_other.php.
<?php
$post = $wp_query- >post;
if ( in_category('1') ) {
include(TEMPLATEPATH . '/single1.php');
} elseif ( in_category('2') ) {
include(TEMPLATEPATH . '/single2.php');
} else {
include(TEMPLATEPATH . '/single_other.php');
}
? >
Unique Category template
Suppose you want to use different Category template to display specific category. Simply save your Category template as category-2.php (note: add “-” and the categoryID number to the file name). So, category-2.php will be used to display categoryID 2, category-3.php will be used for categoryID 3, and so on.
Display Google Ad after the first post
A lot of people have asked me for this. How to display a Google ad after the first post? It is very simple. You just need to add a variable ($loopcounter) in The Loop. If the $loopcounter is less than or equal to 1, then include google-ad.php code.
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); $loopcounter++; ?>
// the loop stuffs
<?php if ($loopcounter <= 1) { include (TEMPLATEPATH . '/ad.php'); } ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
Query Posts
You can use query_posts to control which posts to show up in The Loop. It allows you to control what content to display, where to display, and how to display it. You can query or exclude specific categories, so you get full control of it. Here I will show you how to use query_posts to display a list of Latest Posts, Feature Posts, and how to exclude specific category.
Display Latest Posts
The following code will output the 5 latest posts in a list:
<?php query_posts('showposts=5'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>
Display Feature Posts
Let’s say categoryID 2 is your Feature category and you want to display 5 Feature posts in the sidebar, put this in your sidebar.php:
<?php query_posts('cat=2&showposts=5'); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>
Exclude specific category
You can also use query_posts to exclude specific category being displayed. The following code will exclude all posts in categoryID 2 (note: there is a minus sign before the ID number):
<?php query_posts('cat=-2'); ?>
<?php while (have_posts()) : the_post(); ?>
//the loop here
<?php endwhile;?>
Tips: you can overwrite the posts per page setting by using posts_per_page parameter (ie. <?php query_posts('posts_per_page=6'); ?>)
Custom Fields
Custom field is one the most powerful WordPress features. It allows you to attach extra data or text to the post along with the content and excerpt. With Custom Fields, you can literally trun a WordPress into any web portal CMS. On Web Designer Wall, I use Custom Field to display the article image and link it to the post.
First add the Custom Field in the post.

To display the article image and attach it with the post link, put the following code in The Loop:
<?php //get article_image (custom field) ?>
<?php $image = get_post_meta($post->ID, 'article_image', true); ?>
<a href="<?php the_permalink() ?>"><img src="<?php echo $image; ?>" alt="<?php the_title(); ?>" /></a>
Tips: don’t forget WordPress allows you to create/store multi keys and the keys can be used more than once per post.
I used the same methodology and created a very dynamic template at Best Web Gallery, where I used Custom Fields to display the site thumbnail, tooltip image, and URL.
WP List Pages
Template tag wp_list_pages is commonly used to display a list of WP Pages in the header and sidebar for navigation purpose. Here I will show you how to use wp_list_pages to display a sitemap and sub-menu.
Site map
To generate a sitemap (sample) of all your Pages, put this code in your sitemap Page Template (note: I exclude pageID 12 because page12 is my sitemap page and I don’t want to show it):
<ul>
<?php wp_list_pages('exclude=12&title_li=' ); ?>
</ul>
Dynamic Subpage Menu
Put this in your sidebar.php and it will output a subpage menu if there are subpages of the current page:
<?php
$children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } ?>
Page Template
If you are using WordPress as a basic webpage management, you better don’t miss out the Page Template feature. It allows you to customize how the Pages should be displayed. To use Page Template, first you need to create a Page Template, then you can assign the Page to specific template.
Here is how the Page Template structured (ie. portfolio.php):
<?php
/*
Template Name: Portfolio
*/
?>
<?php get_header(); ?>
//the loop here
<?php get_footer(); ?>
When you are writing or editing a page, look on the right tab “Page Template” and you should see the available templates.

WordPress Options
There are many built-in options in the Admin panels that can make your site much nicer. Here are some of them:
Custom Frontpage
By default, WordPress displays your blog posts on the frontpage. But if you want to have a static page (ie. welcome or splash page) instead, you can set that in Admin > Options > Reading.

Permalinks
Default WordPress uses www.yoursite.com/?p=123 for your post URLs, which is not URL nor search engine friendly. You can change the Permalinks setting through Admin > Options > Permalinks. Personally, I like to set the Permalinks to: /%category%/%postname%/

Category prefix
Default WordPress category prefix is “category” (ie. yoursite.com/category/cat-name/). By entering “article” in the Category base (Options > Permalinks), your category URLs will become: yoursite.com/article/cat-name/

Want more?
WordPress Codex is always the best place to learn about WordPress. Thank you WordPress and happy blogging!
http://www.gabfire.com/are-you-looking-for-wordpress-codes/
Are you looking for Wordpress snippets?
I enjoy developing themes for Wordpress, but sometimes, It takes a lot of time to collect various snippets of code. Thus, I have tried to collect some code snippets that would help you while developing or editing your existing theme. If you have any code you would like me to add, please leave a theme as comment below!
Between <head> and </head>
<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 bloginfo('name'); ?><?php wp_title(); ?></title>
<meta name="description" content="<?php wp_title(); ?>" />
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats please -->
<style type="text/css" media="screen">@import url( <?php bloginfo('stylesheet_url'); ?> );</style>
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_get_archives('type=monthly&format=link'); ?>
<?php //comments_popup_script(); // off by default ?>
<?php wp_head(); ?>
</head>
A quick note to say; You could speed up your Wordpress blog system by changing stylesheet, pingback and feed to static URL’s to static.
<li<?php if(is_home() || is_404() || is_single() || is_category() || is_day() || is_month() || is_year() || is_paged() || is_search() ) { ?> class="current_page_item"<?php } ?>><a href="<?php bloginfo('home'); ?>">Blog</a></li>
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
First snippet will display a text “blog” with a link to the main page and second snippet will print Wordpress pages links in a list (excluding the child pages and title header for the list). The active link from the list will be assigned with “current_page_item” class.
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permalink to <?php the_title(); ?>"><?php the_title();
?></a></h1>
<?php the_content(__('...read on »')); ?>
</div>
<?php endwhile; ?>
<?php else : ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
This is the loop that I use for my themes. You can customize class of div and <h1> tag as it would fit with for your theme.
<?php the_time('F j, Y'); ?>
<?php the_category(',') ?>
<?php the_permalink() ?>
<?php the_title(); ?>
<?php the_author(); ?>
<?php the_ID(); ?>
<?php edit_post_link(); ?>
<?php wp_list_cats(); ?>
<?php next_post_link(' %link ') ?>
<?php previous_post_link('%link') ?>
<?php posts_nav_link(); ?>
<?php posts_nav_link(); ?>
<?php wp_get_archives(); ?>
- Displays date and time. Format: January 21. 2007 More »
- Displays links to categories, each category separated by a comma (if more than one). More »
- Displays the URL to the post More »
- Displays or returns the title of the current post More »
- Displays the author of post More »
- Displays the ID of current post More »
- Displays a link to edit the current post More »
- Displays a list of Categories as links More »
- Displays a link to the next post More »
- Displays a link to the current post More »
- Displays links for next and previous pages More »
- Displays links for next and previous pages. More »
- All available monthly archives links displayed in an <li> Html list (by default). More »
<?php if ( comments_open() ) : ?><p>
<?php comments_popup_link( 'No comments yet', '1 comment', '% comments so far', 'comments-link', 'Comments are off for this post'); ?></p>
<?php endif; ?>
This snippet helps you to hide the paragraph elements <p></p> that contains the comments_popup_link when comments are deactivated in the Write>Post screen. Good for those who want enable/disable comments post by post. Must be used in the loop.
Including templates
<?php get_header(); ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php comments_template(); ?>
<?php include (TEMPLATEPATH . '/yourfilename.php'); ?>
You can split your document into different files such as sidebar.php, header.php, footer.php or yourfilename.php and include theme to your template by adding above lines to your document.
<?php get_archives('postbypost', 8); ?><?php bloginfo('rss2_url'); ?>
<?php bloginfo('comments_rss2_url'); ?>
<?php get_links('-1', '<li>', '</li>', '', '', 'rand', '', '', '5'); ?>
- Displays last 8 post titles
- Displays RSS url for entries
- Displays RSS url for comments
- Display 5 of your blogroll links in a random turn
* I will continue to expand list. So keep this page bookmarked (:























Another Chicken Has Flown the Coup. 


We are in the process of applying the correct attribution to the Flickr image. I apologize if I did not apply the credit to your image. We hope to rectified this very soon.

By joining our newsletter you will receive the latest design ideas, marketing strategies, project updates, industry trends, upcoming events and much more! Sign up here