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 was wondering if it would be possible to embed an html page or add an iframe into a dashboard widget.

I have a multi author blog and i want to make my admin section a simple as possible for some of my author's are less "technical". So I already added a simple widget containing some text. And I took out the less interesting widgets. And I added some links so they can stay on their dashboard page but be able to do everything they had to do.

But I thought it would also be interesting to embed some sort of comment box so they could like talk to each other and discuss things. something like this http://www.htmlcommentbox.com

I gives you some html code wich you can paste into your webpage.

So I started to experiment but all the things I tried came out negative. I thought that if I would be able to simply embed it into a widget or embed it on a html page and view it trough an Iframe it could work. But like I said can't seem to pull it off.

Is it possible? or am I just wasting my time?

thanks in advance

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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' );
share|improve this answer
    
Thanks a lot! It works perfectly! :) –  PenGuin__ Jun 18 '11 at 15:16
    
@PenGuin__: please check the checkmark to accept my answer. Glad to help! –  two7s_clash Jun 18 '11 at 15:32

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.