How to disable 3.1 “Admin Bar” via script for the admin user?

You could use a function inside your theme’s functions file to selectively disable it for specific users. function disable_bar_for_user( $ids ) { if( !is_user_logged_in() ) return; global $current_user; if( is_numeric( $ids ) ) $ids = (array) $ids; if( !in_array( $current_user->data->ID, $ids ) ) return; add_filter( ‘show_admin_bar’, ‘__return_false’, 9 ); } Then call it for the … Read more

wp_trim_words() does not trim the_content() in WordPress

The problem lies in this line: <?php echo wp_trim_words( the_content(), 55, $moreLink); ?> You call the_content function in there. This function prints all the content and doesn’t return anything. It means that you print the content, and then pass an empty string to the wp_trim_words. It should be: <?php echo wp_trim_words( get_the_content(), 55, $moreLink); ?> … Read more

How to redirect WordPress home page to custom static HTML page

This code may help resolve the issue for this particular situation. Put this code in yor theme’s functions.php. add_action(‘template_redirect’, ‘default_page’); function default_page(){ if(is_home() or is_front_page()){ exit( wp_redirect(“http://path/to/your/html/file”)); } } Replace http://path/to/your/html/file to exact url of html file. I hope this helps.

Building useful features into your theme

It’s all site-dependent. I have a few core things I build in to any theme’s functions.php though: Change logo on admin page to suit the client’s company Hide WP-Stats smiley graphic Hide WP.me short URLs and replace with their chosen provider Add option for Twitter, Facebook, and Buzz buttons and ability to pull in Tweets … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)