15 Hacks to Pimp Your WordPress Website

Despite the general awesomeness of WordPress plugins there is a common situation when plugins are an unnecessary headache for the web masters. The point is any plugin brings a series of updates that can crash your WordPress website functionality in some cases.

So if you have some basic PHP skills (we mean really really basic - like being able to copy and paste the pieces of code) or web development experience you might be interested in making some little changes to your WordPress website with your own hands. With this in mind we have prepared for you some short and interesting WordPress hacks that would improve your WP-based without involving any third-party software. There are many simple functions that actually don't need being plugin-powered. These are pagination, contact forms, social media buttons etc. Anyways, just know that this post isn't meant to criticize the existence and usage of WordPress plugins - it's just an alternate point of view so you could have choice. This post is meant for those seeking souls that are looking for simple and interesting solutions to improve their WordPress themes functionality.

How to build a WordPress Post Pagination without plugin

wordpress-theme-hacks

* * *

Display Your Popular Posts In WordPress Without A Plugin

wordpress-theme-hacks

* * *

How to Add Live Comment Preview to Comment Text area without Plugin

wordpress-theme-hacks

* * *

Show Number of Retweets in WordPress Without a Plugin

wordpress-theme-hacks

* * *

Breadcrumbs without plugin

<!--?php 
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 ''; } ?>

* * *

Show Top Commentators In WordPress Without A Plugin

function top_comment_authors($amount = 5){

 global $wpdb;

 $results = $wpdb->get_results('
  SELECT
   COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
  FROM
   '.$wpdb->comments.'
  WHERE
   comment_author_email != "" AND comment_type = "" AND comment_approved = 1
  GROUP BY
   comment_author_email
  ORDER BY
   comments_count DESC, comment_author ASC
  LIMIT '.$amount

 );

 $output = "
    "; foreach($results as $result){ $output .= "
  • ".$result->comment_author."
  • "; } $output .= "

";

 echo $output;

}

* * *

Restrict Admin Menu Items Based on Username

function remove_menus()
{
    global $menu;
    global $current_user;
    get_currentuserinfo();

    if($current_user->user_login == 'username')
    {
        $restricted = array(__('Posts'),
                            __('Media'),
                            __('Links'),
                            __('Pages'),
                            __('Comments'),
                            __('Appearance'),
                            __('Plugins'),
                            __('Users'),
                            __('Tools'),
                            __('Settings')
        );
        end ($menu);
        while (prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
        }// end while

    }// end if
}
add_action('admin_menu', 'remove_menus');

* * *

How to Redirect WordPress Feeds to FeedBurner without a Plugin

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-] )?/?$ http://feeds.feedburner.com/wpbeginner [R=302,NC,L]

* * *

Take Control of your WordPress Admin Bar

function my_admin_bar_link() {
 global $wp_admin_bar;
 if ( !is_super_admin() || !is_admin_bar_showing() )
  return;
 $wp_admin_bar->add_menu( array(
 'id' => 'diww',
 'parent' => 'my-blogs',
 'title' => __( 'Do It With WordPress'),
 'href' => admin_url( 'http://www.doitwithwp.com/wp-admin.php' )
 ) );
}
add_action('admin_bar_menu', 'my_admin_bar_link');

* * *

How To: Inserting Google Maps into WordPress

//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");

* * *

Recent Posts With Thumbnails In WordPress Without A Plugin

wordpress-hacks

* * *

Remove post columns

function remove_post_columns($defaults) {
  unset($defaults['comments']);
  return $defaults;
}
add_filter('manage_posts_columns', 'remove_post_columns');

* * *

How to Generate Perfect WordPress Title Tags without a Plugin

* * *

Random WordPress Quotes Without A Plugin

wordpress-hacks

* * *

Add Social Links to WordPress Without a Plugin

wordpress-hacks

* * *


Edward Korcheg

Edward is a professional technical writer who is also passionate about making stunning designs in Photoshop. You can find many useful tutorials in his collection of articles at MonsterMost.

Get more to your email

Subscribe to our newsletter and access exclusive content and offers available only to MonsterPost subscribers.

From was successfully send!
Server error. Please, try again later.

Leave a Reply