Posts

How to Hide the WordPress Upgrade Message in the Dashboard

All you have to do is simply open the theme’s functions.php file and add this: add_action('admin_menu','wphidenag'); function wphidenag() { remove_action( 'admin_notices', 'update_nag', 3 ); }

Remove Admin Bar WordPress 3.1

WordPress 3.1 comes out with a new function called Admin Bar. This bar is added to your site (both on the dashboard and the site itself) if you’re logged in. Want to remove it? That’s quite easy, just read on Simply paste the following line of code on your functions.php file: remove_action('init', 'wp_admin_bar_init');

Remove Title Attribute from WordPress Menu Link

By default, WordPress menu functions, like wp_page_menu(), wp_nav_menu() or wp_list_categories() display menu links with title attribute. Here’s the code to remove it from wp_page_menu(), wp_nav_menu() and wp_list_categories() function:  function menu_notitle( $menu ){ return $menu = preg_replace('/ title=\"(.*?)\"/', '', $menu ); } add_filter( 'wp_nav_menu', 'menu_notitle' ); add_filter( 'wp_page_menu', 'menu_notitle' ); add_filter( 'wp_list_categories', 'menu_notitle' ); Put the code in your theme funtion.php and no more title attribute in the menu.

Set limit wp_nav_menu

<?php $pages = wp_nav_menu( array( 'container_class' => 'menu1' ,'menu'=> 'Main Navigation','theme_location' => 'menu1', 'menu_class' => 'dropdown', 'echo' =>false,'container' => false ) );?> <ul class="dropdown"> <?php $limit = 5; $pages_list = preg_replace(array('#^ ]*>#','#$#'), '', $pages); $pages_arr = explode("\n", $pages_list); for($i=0;$i<$limit;$i++){     echo $pages_arr[$i]; } ?> </ul>

Easy way to automatically resize large images

div.banner img { max-width: 500px; width: expression(this.width > 500 ? 500: true); }

Set limit wp_list_pages

<?php $numberPage = 5; $pages = wp_list_pages("echo=0&title_li="); $pages_arr = explode("\n", $pages); for($i=0;$i<$numberPage;$i++){ echo $pages_arr[$i]; } ?>

How to disable the WordPress Admin Bar

Image
WordPress 3.1 introduces a new feature called the Admin bar. A lot of people will be wanting to disable this when WordPress 3.1 comes out. But since some people might want to disable the admin bar for everyone, I thought I'd show you a  ways to quickly disable the WordPress admin bar 1. Login in admin page then click on All Users under user box 2. Edit all user that you want to disable then Un-Check on "When view site"