WSOD for admin when using PHP 7

After a lot of testing and considerable frustration, I discovered the problem. I am including this solution in the hope that it saves someone else a lot of frustration if they encounter a similar problem. The problem to be the presence of a PHP closing tag ‘?> ‘ in the functions.php file of the child-theme. … Read more

Different rss feeds in a single dashboard widget

Yes, @toscho is right, the url works with an array of feeds adresses. And if you have 5/6 feeds, the total of items should be 20/24. For clear separation, I think it’s better to run the wp_widget_rss_output function n number of times, and prepare a previous array with titles and addresses and iterate through it. … Read more

Can I limit this meta box to a particular page?

Inside your add_meta_boxex hook callback function, you will have an add_meta_box() call. Wrap that call in a conditional, using data from the $post global (I’m fairly certain it is available in edit.php). For example, you could use either the Page ID or slug. Page ID: global $post; if ( ‘123’ == $post->ID ) { // … Read more

Hooking into add_submenu_page

Hook into admin_head, the last action before the menu is rendered, and change the global $menu: add_action( ‘admin_head’, ‘wpse_71303_change_menu_cap’ ); /** * Change the capability to access an admin menu item. * * @wp-hook admin_head * @return void */ function wpse_71303_change_menu_cap() { global $menu; foreach ( $menu as $key => $item ) { // Find … Read more

Add a banner to the Dashboard

Workaround using jQuery DOM insertion. Note the use of PHP Heredoc sintax to print the script. function wpse_53035_script_enqueuer(){ echo <<<HTML <script type=”text/javascript”> jQuery(document).ready( function($) { $(‘<div style=”width:100%;text-align:center;”><img src=”http://cdn.sstatic.net/wordpress/img/logo.png?v=123″></div>’).insertBefore(‘#welcome-panel’); }); </script> HTML; } add_action(‘admin_head-index.php’, ‘wpse_53035_script_enqueuer’); This inserts the new div at the top before #welcome-panel. If you use the div #dashboard-widgets-wrap it prints in the same … Read more

Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php

Every string goes through translate(), which uses the gettext filter. This mean you can try something like this: add_filter( ‘gettext’, ‘wpse6096_gettext’, 10, 2 ); function wpse6096_gettext( $translation, $original ) { if ( ‘Nickname’ == $original ) { return ‘Funny name’; } if ( ‘Biographical Info’ == $original ) { return ‘Resume’; } return $translation; } … Read more

How do I create a section in the dashboard w/ an input field

This is pretty easy to do with the Dashboard Widgets API http://codex.wordpress.org/Dashboard_Widgets_API. Here are the steps I would take to create this: Queue up a jQuery script for AJAX handling Create a PHP AJAX function and corresponding AJAX hook for saving the form data Create the dashboard widget with HTML form input(s) Here’s a sample … Read more

Removing admin bar from wordpress dashboard

if (!function_exists(‘disableAdminBar’)) { function disableAdminBar(){ remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 ); function remove_admin_bar_style_backend() { echo ‘<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>’; } add_filter(‘admin_head’,’remove_admin_bar_style_backend’); } } add_filter(‘admin_head’,’remove_admin_bar_style_backend’); Source: http://wp.tutsplus.com/tutorials/how-to-disable-the-admin-bar-in-wordpress-3-3/ OR, for both front and back end… if (!function_exists(‘disableAdminBar’)) { function disableAdminBar(){ remove_action( ‘admin_footer’, ‘wp_admin_bar_render’, 1000 ); // for the admin page remove_action( ‘wp_footer’, ‘wp_admin_bar_render’, … Read more

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