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'm coming from a Joomla background and I'm setting up a Wordpress installation for a friend's Shoutcast station. I would have done the setup in Joomla, as I'm more familiar with it, but I wanted to be able to hand administration of the WP install over to my friend once it's going, and I feel Joomla is a bit over her head.

We're using the shout-stream plugin for providing a sidebar stream player. We don't care for the stats display of shout-stream, so I was attempting to use a custom PHP what's playing now script I wrote for another station page I did in Joomla. Joomla has a component/plugin that can encapsulate a PHP script and display it in the sidebar.

My question is:

Is there a similar plugin for Wordpress?

I searched the plugin repository and found one which, at first glance, looked like it might work (wp-wrapper), but further checking indicates it has to be used only on a post or a page. We want the PHP script to run/display in the sidebar. Is there such a plugin for WP or am I stuck going back to Joomla?

Thanks
Dave

share|improve this question
add comment

1 Answer 1

You can use the WordPress widget API to create a custom widget containing your PHP script.

Very simple example:

class shoutcast_widget extends WP_Widget {
    function shoutcast_widget() {
    $widget_ops = array(
        'description' => 'Describe your widget here'
    );
        parent::WP_Widget(false, 'Name Your Widget Here', $widget_ops );  
    }   
    function widget( $args, $instance ) {
        extract( $args );
        extract( $instance );
        echo $before_widget; ?>
            <h3 class="widget_title">Your Widget Title</h3>
        <?php

        // Your Custom PHP Script Here That outputs the display
        echo $after_widget;
    }
}
    register_widget( 'shoutcast_widget' );
share|improve this answer
    
Thank you.. Will look into the api. I've never done any plugin programming on WP (or Joomla), but can probably figure it out.. –  lvdave Dec 5 '11 at 16:19
add comment

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.