Useful WordPress Tricks to be Like a Pro

Battlefield 3 Earn Money

Binary Option Trading Algorithms Success

Examples Of The Analysis And Trade Forex

1- Adding Paypal Donation link

Canadian Stock Market Indexes

here Binary Options Trading Profitable Or Not

function cwc_donate_shortcode( $atts ) {
'text' => 'Make a donation',
'for' => '',    ), $atts));

global $post;

if (!$for) $for = str_replace(" ","+",$post->post_title);
    return '<a class="donateLink" href="'.$account.'&item_name=Donation+for+'.$for.'">'.$text.'</a>';
add_shortcode('donate', 'cwc_donate_shortcode');

Source: Blue-anvil

2- Calling a Short Code in template file or widget

Sometimes a plugin comes up shortcode support that we can use with-in the post body easily. There may be need to use them in widgets area or in a template file. So here’s a widget solution first. Add the below code into functions.php file of your template to enable support for short codes there!

add_filter( 'widget_text', 'do_shortcode' );

What if we want to use that short code in template files, Here a solution to use them anywhere in template files as well. I’m supposing that you want to execute shortcode [donate] at somewhere in template file. Below is the code to go with with-in the PHP tags:

echo do_shortcode('[donate]');

3- Create Member Only Content

If you want some member only content and not visible to public or guest users, you can use below shortcode trick. Add the below code somewhere in functions.php file of your template.

function member_only_check( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return '';
add_shortcode( 'onlymember', 'member_only_check' );

and you’re done. Now you can create member only content like below

[onlymember]This text will be only displayed to registered users.[/onlymember]

Source: Snipplr

4- Hide/Exclude a Page or a post from Navigation

You can hide any page from navigation bar. i’m assuming that you are using wp_page_menu. To exclude some page from being shown, just pass the args like below:


Here we have excluded three pages with id 5, id 9 and id 23. To know the id of page, goto dashboard > All pages. Point mouse over any post and you will see the id at the bottom of browser showing link.

This was it for now! and yeah sorry folks for below image its for thumbnail thing. We will continue writing articles about programming support to ease our readers work. Follow us @facebook @twitter.

wordpress tricks

About the author

With a passion for Knowledge, Smashinghub has been created to explore things like Free Resources For Designers, Photographers, Web Developers and Inspiration.

Twitter Visit author website

Subscribe to Smashing Hub


  1. Dhafian says:

    Great article..

  2. Sumit Nagpal says:

    This is really great.