3 free WordPress themes I’ve created for you

Please note: These themes are offered for free, under the terms of the GPL licence. No free support or help is given.

OpenBook – Magazine theme


Back in 2008, when “magazine” themes where the absolute hype, I’ve released OpenBook, a “magazine” theme inspired by Darren Hoyt’s Mimbo. OpenBook was release on WPHacks, and was downloaded more than 500 times that year.

Just two months ago, I’ve re-released OpenBook in a new version, which is 100% compatible with WordPress 3.0+. This new version includes wp_nav_menu() support, sidebar widgets, and the theme have a complete custom control panel where you can set-up its options.
» Download OpenBook or view the live demo.

Snippet – Thematic child theme


Theme frameworks are quite popular these days. Most are premium themes (Genesis, Thesis) but the best one in my opinion is 100% free. This framework is called Thematic.

I’ve used Thematic intensively last year, on Cats Who Code, my NYC tourism blog Visiter New York and the now abandonned blog PHP Snippets. On this last site, I’ve created a child theme named Snippet: It is simple, clean and perfect for a developer. As I know most of CWC readers are developers, I thought some of you would definitely enjoy it.

» Download Snippet or view the live demo.

jQuery Mobile – Mobile theme


If you’re a CWC reader for some months, you probably remember my How to create a mobile WordPress theme with jQuery Mobile article, which was a tutorial about creating a mobile theme for your WordPress blog, using the excellent framework jQuery Mobile.

This theme, simply named jQuery Mobile is optimized for mobile devices such as the iPhone, Android, Blackberries, etc. It is a great basis for building a mobile website. Of course, you can also use it on your own blog, along with a plugin like IWPhone, which can automatically detect a mobile device and switch from your regular theme to a mobile theme.

» Download jQuery Mobile Theme or view the live demo.

Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!

3 free WordPress themes I’ve created for you

How to show the “home” link on wp_nav_menu default fallback function

You just have to paste the following code into your theme functions.php file:

function my_page_menu_args($args) {
	$args['show_home'] = true;
	return $args;
}
add_filter('wp_page_menu_args', 'my_page_menu_args');

Thanks to Reza for this nice piece of code!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to show the “home” link on wp_nav_menu default fallback function

How to automatically add a search field to your navigation menu

Open your functions.php file, and paste the following code. The search field will be displayed once you saved the file.

add_filter('wp_nav_menu_items','add_search_box', 10, 2);
function add_search_box($items, $args) {

        ob_start();
        get_search_form();
        $searchform = ob_get_contents();
        ob_end_clean();

        $items .= '<li>' . $searchform . '</li>';

    return $items;
}

Thanks to Ronald for the cool tip!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to automatically add a search field to your navigation menu

8 useful sites for web developers

Min.us: The easiest way to upload images


Any developer, designer or webmaster have to share images online with clients and co-workers. Min.us is an all new service that allow you to upload images extremely easily: Just drag and drop them into Min.us and the image will be saved on their servers. A short url will be automatically created so you can share it across the web.
» Visit Min.us

Wirify: Transform any web page into wireframes


Wireframes are extremely useful when designing a website. Wirify is a bookmarklet that allow you to instantly convert any web page into wireframes that you can study or use for your own work.
» Visit Wirify

CSS Resetr: View and compare CSS resets


CSS resets are a must have in any stylesheet in order to render differences between browsers. Since 2004, a lot of differents CSS resets has been published. So, which one is the best for your project? CSS Resetr let you compare the result of the most popular resets on a web page.
» Visit CSS Resetr

Head JS: Speed up your site with 2.30 kb of Javascript


Head JS is a simple and light (2.3 kb) script that will make your site faster by loading other scripts as images. Head JS can do a lot more to modernize your site: CSS3 support, dynamic CSS, etc.
» Visit http://headjs.com/

Copy Paste Character: Use special characters with ease


Special characters are often a pain to deal with, because they’re not on your keyboard, and because you don’t know the related ASCII code. Of course, you can grab an ASCII table and keep it on your desktop, or you can use a new service called Copy Paste Character: Simply click on the selected character to have it copied to your clipboard.
» Visit Copy Paste Character

DB Designr: Create database schemas online


Here is a very great tool to easily create database schemas online. No need to create an account, you can loggin using your Google account (Well, I guess any CWC reader have a Google account!)
» Visit DB Designr

Web 2 pdf convert: Convert any web page to PDF


Web2PDF Converter is a very useful tool that convert any webpage into a PDF file. It works great: I’ve converted 5 pages and all where the exact copy of the html version.
This very handy tool have more to offer: You can email an url and receive the PDF back. You can also add a bookmarklet to your browser for faster archiving.
» Visit web 2 pdf convert

Easily link your html page to your JS library


Are you tired of hunting the Internet in order to find the script tag for the latest version of the Javascript library of your choice? ScriptSrc.net has compiled all the latest versions of jQuery, Mootools, Prototype and more in a single page which lets you copy it in your browser clipboard with a single click.
» Visit ScriptSrc

Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!

8 useful sites for web developers

WordPress tip: Remove WP 3.1 Admin Bar

Simply paste the following line of code on your functions.php file:

remove_action('init', 'wp_admin_bar_init');

Once the file is saved, the Admin Bar will not be displayed again.

Thanks to Yoast for the tip!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

WordPress tip: Remove WP 3.1 Admin Bar

How to easily wish a merry Christmas to your blog readers

To achieve this very simple recipe, simply paste the following code anywhere on your theme. The “Merry Christmas” message will be displayed only on Christmas day.

<?php
if ((date('m') == 12) && (date('d') == 25)) { ?>
    <h2>Merry Christmas from WPRecipes!</h2>
<?php } ?>

By the way, merry Christmas to all of you! Have a great time with the family.

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to easily wish a merry Christmas to your blog readers

WordPress trick: Get category slug using category ID

First, put the following function in your functions.php file:

function get_cat_slug($cat_id) {
	$cat_id = (int) $cat_id;
	$category = &get_category($cat_id);
	return $category->slug;
}

Once done, you can call the function as shown below:

<?php echo get_cat_slug(3); ?>

This will display the slug for the category with the ID 3.

Thanks to Ken Rosaka for the tip!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

WordPress trick: Get category slug using category ID

Awesome WordPress hacks to make your blogger life easier

Hardcode to make WordPress faster

Hardcoding is generally not a good practice, however in the case of an established website, hardcoding your blog url, site url, template path and stylesheet path will make your blog run faster.

When a function such as bloginfo('url') is called, WordPress executes a query to your database to get the value, except if the value can be found on your wp-config.php file.
To hardcode those constants, edit wp-config.php and paste the following (Don’t forget to change the values!):

define('WP_HOME', 'http://www.catswhocode.com'); // blog url
define('WP_SITEURL', 'http://www.catswhocode.com'); // site url
define('TEMPLATEPATH', '/absolute/path/to/wp-content/themes/cwc5');
define('STYLESHEETPATH', '/absolute/path/to/wp-content/themes/cwc5');

Source: http://digwp.com/2009/07/optimize-wordpress-performance-with-the-wp-config-php-file/

Set HTML editor as the default

I know a lot of tech-savvy persons who don’t really like WordPress “visual” editor. Personally, I don’t use it because I’m used to writing HTML, and also because WYSIWYG editors are more likely to produce bad, not valid or dirty code.

If you prefer using the HTML editor, then what about making it your blog default? Just paste the line below into your theme functions.php file, and you’re done.

add_filter('wp_default_editor', create_function('', 'return "html";'));

Source: http://www.wprecipes.com/how-to-set-html-editor-as-the-default-in-wordpress

Make term edition a lot easier

For some reason, WordPress uploader won’t let you upload some filetypes, such as Textmate’s .tmCommand. If you need to upload those files to your WordPress blog, here is a very nice snippet that will allow you to do it.

Simply paste the following code on your functions.php file. If needed, you can add more file types by adding them on line 4, separated by a pipe (|)

<?php
function addUploadMimes($mimes) {
    $mimes = array_merge($mimes, array(
        'tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences' => 'application/octet-stream'
    ));

    return $mimes;
}
?>

add_filter('upload_mimes', 'addUploadMimes');

Source: http://www.wprecipes.com/wordpress-tip-allow-upload-of-more-file-types

Remove autolinks in comments

Links in comments can be a good thing when they’re useful and relevant, but unfortunely lots of people are just leaving links in your comments in order to get clicks and backlinks.
As this became a recurrent problem on my blogs, I’ve looked for a solution and found a piece of code that will make urls appears as text, not as links.

As always, the code have to be pasted to your functions.php file.

remove_filter('comment_text', 'make_clickable', 9);

Source: http://www.wprecipes.com/wordpress-hack-remove-autolinks-in-comments

Easily modify contact info

I always wondered why WordPress still has a Yahoo and a AIM field for user contact information while nowadays, services like Facebook or Twitter became a lot more popular.

This simple hack will remove the AIM, Yahoo and Jabber fields and will replace them with Twitter, Facebook and LinkedIn. Just paste the code below in your functions.php file, and you’re ready to go.

function extra_contact_info($contactmethods) {
    unset($contactmethods['aim']);
    unset($contactmethods['yim']);
    unset($contactmethods['jabber']);
    $contactmethods['facebook'] = 'Facebook';
    $contactmethods['twitter'] = 'Twitter';
    $contactmethods['linkedin'] = 'LinkedIn';

    return $contactmethods;
}
add_filter('user_contactmethods', 'extra_contact_info');

Advanced users would probably enjoy this class which allow you to manage user contact info easily.
Source: http://thomasgriffinmedia.com/blog/2010/09/how-to-add-custom-user-contact-info-in-wordpress/

Leverage browser caching via .htaccess

One of the easiest way to improve your blog speed and general user experience is to leverage browser caching to reduce the number of http queries that the server needs to process. In fact, static files like images or PDF documents are not likely to change often so we can improve our blog speed by telling user browsers that they don’t need to download those files again if they’re already on the browser cache.

Open your .htaccess file (located at the root of your WordPress install) and paste the following. Remember to always make a backup before editing .htaccess.

## EXPIRES CACHING ##

ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"

## EXPIRES CACHING ##

Source: http://thomasgriffinmedia.com/blog/2010/11/how-to-leverage-browser-caching-in-wordpress-via-htaccess/

Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!

Awesome WordPress hacks to make your blogger life easier

How to set HTML editor as the default in WordPress

Simply paste the following code on your functions.php file, save it, and you’re done!

add_filter('wp_default_editor', create_function('', 'return "html";'));

Credit: WP Snippets.

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to set HTML editor as the default in WordPress

How to create a mobile WordPress theme with jQuery Mobile

Here is what we’re going to build together today. Click the image to view the live demo.

Step 1: Getting files

We could have created our theme from scratch, but there’s no need to reinvent the wheel when there’s tools that can help you save lots of time. The tool we’re going to use is called Blank Theme. It is a functional WordPress theme, but without any styling. That way, it can be used as a starting point for creating your own themes. For example, I’ve used Blank Theme to create the current Cats Who Code theme.

Blank Theme has been created by Chris Coyier and it can be downloaded here. Get a copy and unzip it on your server or hard drive: We’re going to start. Optionally, open the style.css file and modify the theme name to fit your own needs.

Step 2: Header and Footer files

As we’re going to create a theme that will rely much on jQuery, the first thing we have to do is to link to jQuery and the jQuery Mobile files. You can either download the files individually and link them to the theme, or you can use jQuery’s CDN and link the online versions to your theme. I personally prefer linking to the online version, but it’s up to you.

Open the header.php file from the Blank Theme directory, and insert the following code to link to jQuery Mobile, within the <head> and </head> tags:

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.css" />
<script src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a1/jquery.mobile-1.0a1.min.js"></script>

Once done, the required jQuery files are now linked to our theme. But we’re not done yet with header.php. As jQuery Mobile uses HTML5, we have to modify the doctype. Replace the first 6 lines of the file with:

<!DOCTYPE html>
<html>
<head>

Then, scroll down to the bottom of the file and locate the <body> tag. Replace everything from the <body> tag until the end of the file by the following:

<body <?php body_class(); ?>>
    <div data-role="page" data-theme="b" id="jqm-home">
        <div data-role="header">
            <h1><?php bloginfo('name'); ?></h1>
	</div>

        <div data-role="content">

We just dove in jQuery Mobile with the code above. What? We haven’t even wrote a single line of JavaScript! That’s right. jQuery Mobile doesn’t need you to write any JavaScript. All it needs is some <div> tags with the proper data-role attribute.

As an explanation, take a look at line 3 of the code above. Have you noticed the data-role="header"? It describe a header bar. If you save the file and view your theme right now, you’ll notice a header bar on the top of the screen, with your blog name.

Now, save header.php and open footer.php. Replace its content by:

        </div><!-- data role content-->

        <div data-role="footer" class="ui-bar">
            <a href="#jqm-home" data-role="button" data-icon="arrow-u">Up</a></div>
        <?php wp_footer(); ?>
    </div><!-- data role content-->
</body>

This simple code will insert a footer bar to our theme, with a button that will scroll up to the header when the user will tap on it. Did you noticed the data-icon attribute? It allows you to specify which kind of icon you want. In our case, we want an up arrow, but there’s lots of different icons you can use.

Step 3: The homepage

Now, let’s code our homepage. As we’re building a theme for mobile devices, we do not need anything fancy. Let’s build a list of our recent posts. To do so, open the index.php file, locate the loop, and replace it by the following code:

<ul data-role="listview" data-inset="true" data-theme="c" data-dividertheme="b">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endwhile;endif ?>
</ul>
<?php include (TEMPLATEPATH . '/inc/nav.php' ); ?>

Save the file and take a look to your theme: It looks great! We now have a list of posts on our homepage. Once again, we have a very good looking list, with some nice transition effects, without coding a single line of JavaScript. That’s the magic of jQuery mobile.

The list is created by using the data-role="listview" attribute on the unordered list. The other attributes specifies the appearance of the list. Want to experiment a bit? Simply replace data-theme="c" by data-theme="b" and see what happens.

Now, modify the loops of the search.php and archive.php files like we did with index.php.

Step 4: Post and pages files

By default, the single.php and page.php files from the Blank Theme looks good in our mobile version, so we do not need to modify those files. Though, we can do something to enhance user experience: Mask the comments by default, and show them only if the user decides to. This can be done extremely easily using jQuery mobile.

Open comments.php and locate line 15. Insert the following line:

<div data-role="collapsible" data-state="collapsed">

Then, go to line 31 and insert a closing </div> just before the else statement. Save the file and have a look at one of your posts: Comments are now masked by default, and a tap/click on the bar display them. If you prefer to show the comments by default, no problem: simply remove the data-state="collapsed" attribute. That’s all we need to create a collapsible content block.

Did you noticed that on posts, the header bar is showing a “Back” button? A click/tap on it will take you back to your blog homepage.

Step 5: Implementing search

Right now, we have a theme fully optimized for mobile devices. But it is missing something important: An easy to access search bar. Open your searchform.php file and replace its content by the following:

<form action="<?php bloginfo('siteurl'); ?>" id="searchform" method="get">
    <div data-role="fieldcontain">
	    <input type="search" name="s" id="search" value="" />
	</div>
</form>

After you saved the file, reopen index.php and include the search form between the get_header() function and the unordered list which contain our posts:

<?php include('searchform.php'); ?>

Our homepage now has a working search form. Right now, our theme is done and we can use it on a production site.

Step 6: Final touches

Of course, even if the theme we’ve built is perfectly functional, there are still a lot of things that can be done to enhance its look and functionality. For example, I have noticed that the search field is smaller than the list items. In order to make the search field as wide as the list items, paste the following in style.css:

.ui-input-search{
    width:96% !important;
}

That’s all for today. I hope you enjoyed this tutorial. If you want to download the finished theme, just click here.

Also, I just redesigned my other blog Cats Who Blog so don’t hesitate to visit it or grab the RSS feed to read it later. The blog is now 100% focused on tools to make your life as a blogger, developer or designer easier. Enjoy!

Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!

How to create a mobile WordPress theme with jQuery Mobile

How to count your blogroll links

Simply paste the following code where you want the count to be displayed:

<?php
$numlinks = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->links WHERE link_visible = 'Y'");
if (0 < $numlinks) $numlinks = number_format($numlinks);
echo $numlinks;
?>

Thanks to Jeff Starr for this tip!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to count your blogroll links

PHP snippets to interact with Twitter

Get number of Twitter followers

Have you seen my blog sidebar? I display the number of followers I have in full text. This is actually pretty easy to do. The first thing you need is this function:

function get_followers($twitter_id){
	$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name='.$twitter_id);
	if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
		$tw['count'] = $match[1];
	}

	return $tw['count'];
}

Once you have the function, you can call it as shown below:

$nb =  get_followers('phpsnippets');
echo "PHP Snippets already have ".$nb." followers!";

» Credit: http://www.phpsnippets.info/get-twitters-followers-in-php

Get latest Twitter status

Using PHP and cURL, it is pretty easy to get the status of a specific user. Once you have it, what about displaying it on your blog, like I do in WPRecipes footer?

function get_status($twitter_id, $hyperlinks = true) {
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, "http://twitter.com/statuses/user_timeline/$twitter_id.xml?count=1");
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    $src = curl_exec($c);
    curl_close($c);
    preg_match('/<text>(.*)<\/text>/', $src, $m);
    $status = htmlentities($m[1]);
    if( $hyperlinks ) $status = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", '<a href="%5C%22%5C%5C0%5C%22">\</a>', $status);
    return($status);
}

The function is extremely easy to use:

echo get_status('catswhocode');

» http://www.phpsnippets.info/get-twitter-status-using-php

Link to update status, without encoding problems

Many websites and blogs show you how to create a link to Twitter that will update your status. But unfortunely, most websites don’t explain what you need to do in order to avoid encoding problems of spaces and special characters.

<a href="http://twitter.com?status=@catswhocode Hi Jean, how are you?">Tweet!</a>

So, where’s the change? Pretty simple: Just note that I havent linked to http://www.twitter.com, but to http://twitter.com, without the www.

A working example can be seen on my company website: http://www.webdevcat.com/contact.

Get number of retweets for a specific page

Most bloggers are using the Tweetmeme widget to display the number of retweets of their posts. Did you know that Tweetmeme also has an API you can use to get how many times a specific url has been retweeted?

The following function will get the number of RT’s of the url passed as a parameter:

function tweetCount($url) {
    $content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
    $element = new SimpleXmlElement($content);
    $retweets = $element->story->url_count;
    if($retweets){
        return $retweets;
    } else {
        return 0;
    }
}

Using the function is easy, as you can expect:

echo tweetCount('http://www.catswhocode.com');

Note that the Twitter API also provide a way to get the number of retweets. See http://urls.api.twitter.com/1/urls/count.json?url=www.google.com for example.

» http://www.phpsnippets.info/get-how-many-times-a-page-have-been-retweeted-using-php

Testing friendship between two users

If you want to know if a specific user is following you (or someone else) you have to use the Twitter API. This snippet will echo true if the two users specified on lines 18 and 19 are friends. It will return false otherwise.

/* makes the request */
function make_request($url) {
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$url);
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
	$result = curl_exec($ch);
	curl_close($ch);
	return $result;
}

/* gets the match */
function get_match($regex,$content) {
	preg_match($regex,$content,$matches);
	return $matches[1];
}

/* persons to test */
$person1 = 'phpsnippets';
$person2 = 'catswhocode';

/* send request to twitter */
$url = 'https://api.twitter.com/1/friendships/exist';
$format = 'xml';

/* check */
$persons12 = make_request($url.'.'.$format.'?user_a='.$person1.'&user_b='.$person2);
$result = get_match('/<friends>(.*)<\/friends>/isU',$persons12);
echo $result; // returns "true" or "false"

» http://www.phpsnippets.info/get-twitter-status-using-php

Shorten urls for Twitter

As you know if you’re a Twitter user, you can’t post messages which are longer than 140 characters. To avoid this problem, you have to use an url shortener. There’s lots of different url shorteners on the internet. TinyUrl.com is one of them, it doesn’t produce the shortest urls but what I really love it is that you don’t need to have an account to use it with PHP.

The following function takes a long url as a parameter and return a shorter url, using the TinyUrl url shortener.

function getTinyUrl($url) {
    return file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
}

» http://www.phpsnippets.info/convert-url-to-tinyurl

Shorten urls using Bit.ly

In the previous snippet of that article, I’ve shown you how you can shorten your urls using TinyUrl.com. This is cool, but I’m pretty sure some of you prefer using the bit.ly service. No problem, you can still use PHP to get your shortened url.

function bitly($url) {
	$content = file_get_contents("http://api.bit.ly/v3/shorten?login=YOURLOGIN&apiKey=YOURAPIKEY&longUrl=".$url."&format=xml");
	$element = new SimpleXmlElement($content);
	$bitly = $element->data->url;
	if($bitly){
		return $bitly;
	} else {
		return '0';
	}
}

To use the function, simply use the following:

echo bitly("http://www.catswhocode.com");

» http://woorkup.com/2010/06/06/3-practical-wordpress-code-snippets-you-probably-must-know/

Like CatsWhoCode? If yes, don’t hesitate to check my other blog CatsWhoBlog: It’s all about blogging!

PHP snippets to interact with Twitter

WordPress tip: How to make term edition easier

Simply paste this function on your functions.php file:

if ( !function_exists('edit_term_link') ) {
  function edit_term_link( $link = '', $before = '',
      $after = '', $term = null ) {

    if ( $term == null ) {
      global $wp_query;
      $term = $wp_query->get_queried_object();
    }

    $tax = get_taxonomy( $term->taxonomy );
    if ( !current_user_can($tax->cap->edit_terms) )
      return;

    if ( empty($link) )
      $link = __('Edit This');

    $link = '<a href="' . get_edit_tag_link( $term->term_id,
        $term->taxonomy ) . '" title="' . $link . '">' . $link . '</a>';
    echo $before .
       apply_filters( 'edit_term_link', $link, $term->term_id ) . $after;
  }
}

Once you saved your functions.php file, add the following code on any category, tag or taxonomy template:

<?php edit_term_link(); ?>

It will output a link (only if you’re logged in as an administrator, of course) to quickly edit the term.

Thanks to Joost de Valk for this great function!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

WordPress tip: How to make term edition easier

How to count retweets in full text on your WordPress posts

The first thing to do is to open your functions.php file and insert the following function:

function tweetCount($url) {
    $content = file_get_contents("http://api.tweetmeme.com/url_info?url=".$url);
    $element = new SimpleXmlElement($content);
    $retweets = $element->story->url_count;
    if($retweets){
        return $retweets;
    } else {
        return 0;
    }
}

Once done, open your single.php file and paste the following:

$rt = tweetCount(get_permalink());
echo "Retweeted ".$rt." times.";

Source

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to count retweets in full text on your WordPress posts

How to easily modify user contact info

Simply paste the following function into your theme functions.php file. Lines 2, 3 and 4 are for removing unnecesseray items, and lines 5, 6 and 7 add news items. That’s simple as that.

function extra_contact_info($contactmethods) {
    unset($contactmethods['aim']);
    unset($contactmethods['yim']);
    unset($contactmethods['jabber']);
    $contactmethods['facebook'] = 'Facebook';
    $contactmethods['twitter'] = 'Twitter';
    $contactmethods['linkedin'] = 'LinkedIn';

    return $contactmethods;
}
add_filter('user_contactmethods', 'extra_contact_info');

Advanced users would probably enjoy this class which allow you to manage user contact info easily.

Big thanks Thomas Griffin for the snippet!

Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!

How to easily modify user contact info