03 Dec 2011

WordPress: Remove Default Contact Methods

You can remove the default contact methods (AIM, Yahoo IM, Jabber / Google Talk) in Personal Options. Add the following lines to your Theme’s template functions.php file or create it as a Plugin by filling the additional Standard Plugin Information:

add_filter( 'user_contactmethods', 'custom_user_contactmethods' );
function custom_user_contactmethods( $user ) {
        $user_contactmethods = array(
                'aim',
                'yim',
                'jabber'
        );

        foreach ( $user_contactmethods as $user_contactmethod ) {
                unset( $user[$user_contactmethod] );
        }

        return $user;
}

Need a new website? Top UK web developers and designers.

Kemuda Web Directory.

Cheap and strong web directory will pass PR to your site.

18 Dec 2010

WordPress: Better previous and next post links

To be used on single post, the snippet below will not output unnecessary markup if there’s:

  1. only 1 published post.
  2. no post that is adjacent (previous or next) to current post.
<?php php if ( get_adjacent_post( false, '', false ) ||  get_adjacent_post( false, '', true ) ) : ?>
  <div class="navigation">
    <?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">&larr;</span> %title' ); ?>
    <?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">&rarr;</span>' ); ?>
  </div>
<?php endif; ?>