Showing posts from January, 2012

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); }