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.

Merry Christmas from WPRecipes!

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


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.


WordPress hack: Remove autolinks in comments

To remove automatic linking of urls in comments, simply open your functions.php file and paste the following: remove_filter('comment_text', 'make_clickable', 9);

That's all! Once saved, you can say bye bye to spammy links in comments.

This recipe has been initially published on CatsWhoCode. Don't forget to read CWC's list of 10 new WordPress hacks!


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

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 = '' . $link . ''; 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:

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!


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

How to count your blogroll links

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

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!


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

How to show a different number of posts for a WordPress category

I used this tip on a category that's very image intensive to show only 5 posts rather than 10 posts per page. This allowed me to reduce page load times on this category page, whilst still leaving the rest of the website easy to browse.

Open up archive.php and add the following code before the loop.

And then after the loop, just paste this:

You can use any of the conditional tags to determine when to show more or less pages, I chose to use the function that checks for a category by name. I hope it comes in useful!

Thanks to Dan Harrison of WP Doctors for the tip!


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

How to easily get post ancestors

In order to get the post ancestors (also called parents) simply use the get_post_ancestors() function. This function takes a single argument which can be either the post ID or post object, and return the ancestors IDs as an array. $ancestors = get_post_ancestors($post);

Thanks to Coen Jacobs for this great piece of code!


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.

How to use WordPress shortcode outside in your theme files

Simply use the do_shortcode() function anywhere in your theme file. The shortcode you want to use have to be given to the function as shown below:

That's all :)

Recipe initially published on CatsWhoCode.


View the original article here


This post was made using the Auto Blogging Software from WebMagnates.org This line will not appear when posts are made after activating the software to full version.