Dynamic Web Lab

How to add facebook likebox in wordpress post or page using shortcode

If you want to show your facebook fanpage likebox in wordpress post or page then copy and past the code below in your theme function.php [php] //ADD FACEBOOK LIKE BOX SHORTCODE function fb_likebox($atts) { extract(shortcode_atts(array( "fb_link" => ‘https://www.facebook.com/techsloution4u’ ), $atts)); return ‘<h2 class="join-fb">Like Them On Facebook</h2> <fb:like-box href="’.$fb_link.’" width="595" height="100" show_faces="false" stream="false" header="false"></fb:like-box>’; } add_shortcode(‘fb_box’, […]

Read More

Add logo to wordpress dashboard login without plugin

If you want to change the WordPress dashboard login logo then this piece of code can meet your requirement. Just paste this code in the your theme functions.php [php] function custom_login_logo() { echo ‘<style type="text/css"> h1 a { background-image:url(‘.get_bloginfo(‘template_directory’).’/images/custom-login-logo.png) !important; } </style>’; } add_action(‘login_head’, ‘custom_login_logo’); [/php]

Read More

Some very useful wordpress hacks

Today i organize some very useful WordPress hacks.Hope this may help you in your future projects Display number of Facebook fans in full text If you want to display the number of your Facebook Fans then use this code. Replace “YOUR PAGE-ID” with your own Page-ID. Code: [php]$page_id = "YOUR PAGE-ID"; $xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or […]

Read More

get post publish date outside the loop in wordpress

To get post publish date outside the loop in wordpress use the following code. [php] $all_posts = get_posts(array(‘numberposts’=>-1, ‘post_status’=> ‘publish’)); //Get all published posts foreach ($all_posts as $single_post){ echo get_the_time(‘Y-m-d’, $single_post->ID); //The date is on Y-m-d format echo ‘<br />’ ; } [/php] Hope this code will help you. Thanks

Read More

Journal – Free wordpress Bootstrap theme

I have lunched a new free WordPress Bootstrap theme. This theme is packed with features : Using Bootstrap framework Theme option panel Video support Widget ready Language support And best of all free to use Here is the live theme demo Download from Github https://github.com/maidulcu/JOURNAL.git

Read More

Load jquery library from google CDN in wordpress

Add this code on wordpress theme functions.php to deregister the urgent jquery and load jquery library from google. [php] function load_cdn_jquery() { // only use this method is we’re not in wp-admin if (!is_admin()) { // deregister the original version of jQuery wp_deregister_script(‘jquery’); // discover the correct protocol to use $protocol=’http:’; if($_SERVER[‘HTTPS’]==’on’) { $protocol=’https:’; } […]

Read More

Removing extra p and line breaks from shortcodes in WordPress

Some time shortcodes add some some extra <p> and <br /> after of before post.This is happend because of the wpautop filter. You can easily prevent this by changing the execution priority of wpautop filter. Simply use this code on your theme functions.php [php] remove_filter( ‘the_content’, ‘wpautop’ ); add_filter( ‘the_content’, ‘wpautop’ , 12);[/php]

Read More

New Code to Display Latest Tweets

[highlight]The code below no longer works as-is with the Twitter API update to 1.1 as of 2013-06-11.Here’s a PHP way to interact with the new Twitter API.[/highlight] Twitter recently deprecated the code that we using to display latest tweets [php] <div id="twitter_update_list"></div> <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/maidul.json?callback=twitterCallback2&count=1"></script> [/php] So the above code will not […]

Read More