Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know it's probably not encouraged, but is there a way to replace the standard dashboard widgets (Recent Drafts, Quickpress, etc.) with a standard image banner ad?

I know how to add new dashboard widgets, but I want this to be a plain image with no surrounding widget.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Check this reference

http://www.wpbeginner.com/wp-themes/how-to-add-custom-dashboard-widgets-in-wordpress/

for adding dashboard widget

Remove Widgets in Dashboard

for removing dashboard widget

add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
function example_remove_dashboard_widgets() {
    remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );

    remove_meta_box( 'dashboard_browser_nag', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
    wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');
}
function custom_dashboard_help() {
    echo 'Your custom banner code';
    }
share|improve this answer
    
Please provide code in answers, not just links - there is no guarantee that those resources will always be available. :) –  Stephen Harris Apr 27 '12 at 11:55
    
check my edit.. –  Mohit Bumb Apr 27 '12 at 11:59

Everything you need to know is here:
http://codex.wordpress.org/Dashboard_Widgets_API#Examples

remove all standard dashboard widgets:
in functions.php

<?php
add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );
function example_remove_dashboard_widgets() {
    remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
    remove_meta_box( 'dashboard_secondary', 'dashboard', 'side' );

    remove_meta_box( 'dashboard_browser_nag', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
    remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
}
share|improve this answer
// Add & Remove meta boxes
function wpse50413_alter_dashboard_widgets()
{
    // For details on removing widgets, see answer by @janw
    remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );

    // @link http://codex.wordpress.org/Function_Reference/add_meta_box
    add_meta_box( 'dashboard_ad_widget', 'Your Ad Title here', 'wpse50413_add_adbox', null, 'dashboard' );
}
add_action( 'wp_dashboard_setup', 'wpse50413_alter_dashboard_widgets' );

// The callback function, that defines the ad
function wpse50413_add_adbox()
{
    // display add here - this is the ad boxes contents
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.