Automatically add Twitter and Facebook buttons to your posts

Automatically add Twitter and Facebook buttons to your posts

Paste the code below into your functions.php file, save it, and you’re done. function share_this($content){ if(!is_feed() && !is_home()) { $content .= '<div class="share-this"> <a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a> <script...

Read More

How to show the “home” link on wp_nav_menu default fallback function

How to show the “home” link on wp_nav_menu default fallback function

You just have to paste the following code into your theme functions.php file: function my_page_menu_args($args) { $args['show_home'] = true; return $args; } add_filter('wp_page_menu_args', 'my_page_menu_args'); Thanks to Reza for this nice piece of code! Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!How to show...

Read More

How to automatically add a search field to your navigation menu

How to automatically add a search field to your navigation menu

Open your functions.php file, and paste the following code. The search field will be displayed once you saved the file. add_filter('wp_nav_menu_items','add_search_box', 10, 2); function add_search_box($items, $args) { ob_start(); get_search_form(); $searchform = ob_get_contents(); ob_end_clean(); $items .= '<li>' ....

Read More

WordPress tip: Remove WP 3.1 Admin Bar

WordPress tip: Remove WP 3.1 Admin Bar

Simply paste the following line of code on your functions.php file: remove_action('init', 'wp_admin_bar_init'); Once the file is saved, the Admin Bar will not be displayed again. Thanks to Yoast for the tip! Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!WordPress tip: Remove WP 3.1 Admin...

Read More

WordPress trick: Get category slug using category ID

WordPress trick: Get category slug using category ID

First, put the following function in your functions.php file: function get_cat_slug($cat_id) { $cat_id = (int) $cat_id; $category = &get_category($cat_id); return $category->slug; } Once done, you can call the function as shown below: <?php echo get_cat_slug(3); ?> This will display the slug for the category with the ID 3. Thanks to Ken Rosaka for the tip! Looking for WordPress...

Read More

How to set HTML editor as the default in WordPress

How to set HTML editor as the default in WordPress

Simply paste the following code on your functions.php file, save it, and you’re done! add_filter('wp_default_editor', create_function('', 'return "html";')); Credit: WP Snippets. Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for free!How to set HTML editor as the default in...

Read More