Replace dashboard widgets with banner ad

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.

Related posts

Leave a Reply

3 comments

  1. 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';
        }
    
  2. // 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
    }
    
  3. 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' );
    }