How to Display Only Certain Categories in a Menu

In many cases, users only want to display certain categories in their navigation menu at the top of the page. There are limited spots, that can only be filled by top categories, but if you use the default wp_list_categories code, it will show all categories. This is why this hack below comes in very...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

How to Highlight Author’s Comment

This is a simple and easy trick. First you need to open your style.css in your template folder and add the following: authorstyle { background-color: #B3FFCC !important; } Then you need to open your comments.php which is also located in your themes folder and find the code that looks some...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

Link to External Links from Your Post Title

This trick will allow you to link to external links from your post title in WordPress. First open your functions.php file and add the following codes in there: function print_post_title() { global $post; $thePostID = $post->ID; $post_id = get_post($thePostID); $title = $post_id->post_title; $perm...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

Create a Page that Displays Random Posts

Have you ever been to a site and saw this cool feature? They have a link in their top navigation to something like Stumbe! or Read Random Articles, or some other creative text. When you click on that link, it takes you to a page that displays one random page. Each time you refresh, you are delivered...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

How To Display Screenshot Of Any Website Using Shortcode

You can make your blogging faster using a shortcode to add screenshot automatically. Copy-paste the following code snippet to the functions.php file of your WordPress theme. It will let you use the below mentioned shortcode to display a screenshot of any website. The default width and height of the screenshots...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

How To Create a Drop Down List For Posts On WordPress

Adding this snippet to your wordpress theme will display a list of all your posts within a dropdown menu. You can adjust the number of posts displayed by changing the -1 value within the $args array. ?><form action="<?php bloginfo('url'); ?>" method="get"> <select...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

How To Add The Google +1 Automatically

This tip can be applied to any other content you’d like to dynamically add to the end of your posts, but here’s how to add a Google +1 recommendation button under each post. Open your theme’s functions.php file and paste the following code: add_filter('the_content', 'google_plusone'); function...

Profile photo of mrs.shoma
mrs.shoma
November 29, 2012


READ MORE  

When profile updates send email notification

I got a few emails asking about sending an email when a user simply updates the profile. Well here it is, adding this snippet to the functions.php of your wordpress theme will send an email notification to the user when the user profile updates. function user_profile_update( $user_id ) { $site_url...

Profile photo of mrs.shoma
mrs.shoma
November 28, 2012


READ MORE  

How to add CSS class to next and previous post_link

These two functions add a custom CSS class to next and previous post_link. Add this snippet to the functions.php : function add_class_next_post_link($html){     $html = str_replace('<a','<a',$html);     return $html; } add_filter('next_post_link','add_class_next_post_link',10,1); function...

Profile photo of mrs.shoma
mrs.shoma
November 28, 2012


READ MORE  

Increased height of the excerpt field

Adding this code to the functions.php of your wordpress theme will increase height of the excerpt field within your post editing screen. add_action('admin_head', 'excerpt_textarea_height'); function excerpt_textarea_height() { echo' <style type="text/css"> ...

Profile photo of mrs.shoma
mrs.shoma
November 28, 2012


READ MORE  

How to show an author’s avatar within posts or pages

Adding this snippet to your wordpress theme within the loop will display the current authors avatar. echo get_avatar( get_the_author_email(), '60' ); ...

Profile photo of mrs.shoma
mrs.shoma
November 28, 2012


READ MORE  

Show the comment count using a shortcode

Use this shortcode to display a specific post’s comment count. function comments_shortcode($atts) { extract( shortcode_atts( array( 'id' => '' ), $atts ) ); $num = 0; $post_id = $id; $queried_post = get_post($post_id); $cc = $queried_post->comment_count; if( $cc...

Profile photo of mrs.shoma
mrs.shoma
November 28, 2012


READ MORE  
home