Supercharged WordPress Themes

Premium WordPress Themes that Work Seamlessly, Tailored for Every Business - That's what I do

10 Awesome WordPress hacks to enhance your blog’s usability

wordpress tricks and hacks
Tweak your blog and stand out of the crowd. I’ve gathered a list of 10 awesome WordPress hacks and tricks to enhance your blog’s usability. Some of these WordPress hacks will will definitely make your blogging life easier and create a better user experience for your readers.

WordPress Breadcrumbs without plugin.

wordpress breadcrumbs Breadcrumbs are an elegant way to help your blog’s visitors understand where they are on the website and to enable them to easily navigate up in the blog hierarchy. Here is a nice hack to create a WordPress breadcrumbs navigation system without the need of a plugin. From your theme’s files open functions.php and paste the following code: [raw] function the_breadcrumb() { echo ‘
    ‘; if (!is_home()) { echo ‘
  • ‘; echo ‘Home'; echo “
  • “; if (is_category() || is_single()) { echo ‘
  • ‘; the_category(‘
  • ‘); if (is_single()) { echo “
  • “; the_title(); echo ‘
  • ‘; } } elseif (is_page()) { echo ‘
  • ‘; echo the_title(); echo ‘
  • ‘; } } elseif (is_tag()) {single_tag_title();} elseif (is_day()) {echo”
  • Archive for “; the_time(‘F jS, Y’); echo’
  • ‘;} elseif (is_month()) {echo”
  • Archive for “; the_time(‘F, Y’); echo’
  • ‘;} elseif (is_year()) {echo”
  • Archive for “; the_time(‘Y’); echo’
  • ‘;} elseif (is_author()) {echo”
  • Author Archive”; echo’
  • ‘;} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo “
  • Blog Archives”; echo’
  • ‘;} elseif (is_search()) {echo”
  • Search Results”; echo’
  • ‘;} echo ‘
‘; } [/raw] Now, paste this anywhere you want the breadcrumbs to show on your blog (preferably paste it in header.php): [raw] [/raw] Source: Breadcrumbs without plugin

Adding custom user fields.

custom user fields Do you allow your users to post on your blog? Here’s a simple technique to allow your guest posters to input more information about themselves. Paste this piece of code in your theme’s functions.php file: [raw] // Adding custom user fields add_action( ‘show_user_profile’, ‘my_show_extra_profile_fields’ ); add_action( ‘edit_user_profile’, ‘my_show_extra_profile_fields’ ); function my_show_extra_profile_fields( $user ) { ?>

Extra profile information

<input type="text" name="twitter" id="twitter" value="ID ) ); ?>” class=”regular-text” />
Please enter your Twitter username.

Article written by

<?php } [/raw] Now, drop this line in your single.php file to call the function: [raw][/raw] Source: Adding and using custom user profile fields

Automatically add a home link to your WordPress 3 nav menus.

If you’re using or have upgraded to WordPress 3 version you definitely noticed that there is no simple and effective way in the admin panel to add a “Home” link to your navigation menus. Simply drop this code into your theme’s functions.php file and you’re done. [raw] function addHomeMenuLink($menuItems, $args) { if(‘main’ == $args->theme_location) { if ( is_front_page() ) $class = ‘class=”current_page_item”‘; else $class = ”; $homeMenuItem = ‘
  • ‘ . $args->before . ‘‘ . $args->link_before . ‘Home’ . $args->link_after . ‘‘ . $args->after . ‘
  • ‘; $menuItems = $homeMenuItem . $menuItems; } return $menuItems; } add_filter( ‘wp_nav_menu_items’, ‘addHomeMenuLink’, 10, 2 ); [/raw] Source: How To Add A Home Link To A WordPress 3 Nav Menu

    Easily insert Google Maps into your WordPress posts or pages without the need of a plugin.

    Forget the conventional ways of sharing locations with your blog’s readers. Instead, show them directly in Google Maps for a better user experience. The good news is that no plugin is required. Drop these lines in your functions.php theme file: [raw] //Google Maps Shortcode function do_googleMaps($atts, $content = null) { extract(shortcode_atts(array( “width” => ‘640’, “height” => ‘480’, “src” => ” ), $atts)); return ”; } add_shortcode(“googlemap”, “do_googleMaps”); [/raw] Now, paste this in your posts or pages when you need to show locations. [raw]
    “][/raw] Remember to replace [you_url] with the link from Google Maps. I guess the width and height parameters are self explanatory. google maps location link Source: Google Maps Shortcode

    Exclude certain posts from your feed.

    If you don’t want certain posts to appear in your blog’s feed here’s a short code that will do the trick. Simply paste it in your functions.php file. [raw] function fb_exclude_filter($query) { if ( !$query->is_admin && $query->is_feed) { $query->set(‘post__not_in’, array(40, 9) ); // id of page or post } return $query; } add_filter( ‘pre_get_posts’, ‘fb_exclude_filter’ ); [/raw] Source: Exclude Post from WordPress Feed

    Display the scheduled posts to your visitors.

    Tease your readers by allowing them to see the upcoming posts. Creating a sense of suspense is nice. Paste this piece of code anywhere in your theme files: [raw] have_posts()) { while ($my_query->have_posts()) : $my_query->the_post(); ?> [/raw]

    Display author’s bio at the end of their posts.

    wordpress author bio information Many readers want to know that the information they read is not written by “some anonymous guy on the Interwebz”. Show them a little info about the post’s author and your blog will gain more credibility. To do this, simply paste these piece of code in your theme’s functions.php file: [raw] function get_author_bio($content=”){ global $post; $post_author_name=get_the_author_meta(“display_name”); $post_author_description=get_the_author_meta(“description”); $html=”
    n”; $html.=”PGn”; $html.=”
    n”; $html.=”

    Author: “.$post_author_name.”

    n”; $html.= $post_author_description.”n”; $html.=”
    n”; $html.=”
    n”; $content .= $html; return $content; } add_filter(‘the_content’, ‘get_author_bio’); [/raw] Source: Show author information on each WordPress post

    Sort category archive posts by subcategory

    sort wordpress categories Here’s a nice piece of code to sort your archive posts by the category and subcategory they belong in. Alphabetically and chronologically. Paste this code anywhere you want to display your blog archives: [raw]
    cat_ID&showposts=-1&order=ASC&orderby=name”); ?>

    cat_ID); ?>

    <a href="” rel=”bookmark” title=”Permanent Link to “>

    [/raw] Source: WordPress: How to Sort Category Archive Posts by Subcategory

    Show update notifications just to admin users.

    Don’t let your users know that you forget to update your WordPress installation or plugins from time to time. Show the update notifications just to the admin users. Drop this piece of code where else than in your theme’s functions.php file: [raw] // REMOVE THE WORDPRESS UPDATE NOTIFICATION FOR ALL USERS EXCEPT SYSADMIN global $user_login; get_currentuserinfo(); if (!current_user_can(‘update_plugins’)) { // checks to see if current user can update plugins add_action( ‘init’, create_function( ‘$a’, “remove_action( ‘init’, ‘wp_version_check’ );” ), 2 ); add_filter( ‘pre_option_update_core’, create_function( ‘$a’, “return null;” ) ); } [/raw] Source: Remove Update Notification for all users except ADMIN User

    Easy PayPal Donation

    paypal donation link Let your readers reward you with a beer/coffee/etc for your work. Easily place your donation link in any post or page. Paste this snippet in your functions.php file: [raw] ‘your-paypal-email-address’, ‘for’ => $post->post_title, ‘onHover’ => ”, ), $atts));

    if(empty($content)) $content=’Make A Donation'; return ‘‘.$content.’‘; } add_shortcode(‘donate’, ‘donate_shortcode’); ?> [/raw] Now, use these shortcodes wherever you want to display a PayPal donation link. [raw] [donate] [donate]Donate Now[/donate] [donate account="you@yoursite.com" onHover="Thanks" for="Title"] [donate account="you@yoursite.com" onHover="Thanks" for="Title"]Donate Now[/donate] [/raw] Source: PayPal Donation Shortcode

    Leave a reply

    Your email address will not be published. Required fields are marked *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>