Embed iframe or html page into dashboard widget

Sure, you can do this. It sounds like it would make more sense to add a protected forum to your installation though… but here’s how you would do it:

// Create the function to output the contents of our Dashboard Widget
function iframe_dashboard_widget_function() {
    // Display whatever it is you want to show
    echo '<iframe src="http://www.htmlcommentbox.com" width="100%" height="300" frameBorder="0">Browser not compatible.</iframe>';
}

// Create the function use in the action hook
function example_add_dashboard_widgets() {
    wp_add_dashboard_widget('iframe_dashboard_widget', 'Iframe Dashboard Widget', 'iframe_dashboard_widget_function');
}

// Hook into the 'wp_dashboard_setup' action to register our other functions
add_action('wp_dashboard_setup', 'example_add_dashboard_widgets' );

Leave a Comment