Use Shortcodes Within WordPress Text Widget

Shortcodes Within WordPress

Some days ago I shared a tip on using PHP snippets within WordPress text Widgets. Here’s another equally handy snippet for using Shortcodes within WordPress text widget. To allow shortcodes within WordPress text widgets, simply edit the functions.php file from your theme and add the following code Shortcodes Within WordPress snippets add_filter(‘widget_text’, ‘do_shortcode’); Once you…

Create A Login Form Shortcode For Your WordPress Blog

Once you’ve added this to your functions.php file, you can add a login form to any post or page by inserting the shortcode [devpress-login-form]. function devpress_login_form_shortcode() { if ( is_user_logged_in() ) return ”; return wp_login_form( array( ‘echo’ => false ) ); } function devpress_add_shortcodes() { add_shortcode( ‘devpress-login-form’, ‘devpress_login_form_shortcode’ ); } add_action( ‘init’, ‘devpress_add_shortcodes’ );

Shortcode To Display Youtube Thumbnail in WordPress

Insert YouTube videos into your content easily with shortcodes with this cool snippet. /* Shortcode to display youtube thumbnail on your wordpress blog. Usage: [youtube_thumb id=”VIDEO_ID” img=”0″ align=”left”] VIDEO_ID= Youtube video id img=0,1,2 or 3 align= left,right,center */ function wp_youtube_video_thumbnail($atts) { extract(shortcode_atts(array( ‘id’ => ”, ‘img’ => ‘0’, ‘align’=>’left’ ), $atts)); $align_class=’align’.$align; return ‘<img src=”http://img.youtube.com/vi/’.$id.’/’.$img.’.jpg”…