CodeCanyon

Using Plugins in your WordPress Themes

2079 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 4-5 years
  • Won a Competition
+10 more
mpc moderator says

Hi guys, most of you here are much more experienced in developing WordPress themes thats why I have another questions for you. I am developing some themes and would like them to share some additional widgets like: popular posts, twitter, ect. WordPress.org hosts some great plugins that can do that, my question is do you use plugins and just skin them or write the whole thing by yourself (which seams a little silly because it is already done…). If you are using plugins how do you integrate them into theme, do they automatically install along with a Theme or what is your solution?

1 post
  • Has been a member for 1-2 years
red-5 says

I would also like to know the answer to this :)

2507 posts Put a Donk On It
  • Exclusive Author
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Attended a Community Meetup
  • Referred between 100 and 199 users
  • Contributed a Tutorial to a Tuts+ Site
+5 more
ThemeProvince says

Hi guys,

I create custom widgets from scratch as it is easier in the long run.

Here is a standard custom wordpress widget. Simply place it in your functions.php or anywhere in the plugin your developing.

I wouldn’t recommend using widgets that rely on a plugin because this is a very uncommon practice.

Custom WordPress widgets need to be registered in functions.php in order to be available in the theme your developing.


/**
 * Foo_Widget Class
 */
class Foo_Widget extends WP_Widget {
    /** constructor */
    function __construct() {
        parent::WP_Widget( /* Base ID */'foo_widget', /* Name */'Foo_Widget', array( 'description' => 'A Foo Widget' ) );
    }

    /** @see WP_Widget::widget */
    function widget( $args, $instance ) {
        extract( $args );
        $title = apply_filters( 'widget_title', $instance['title'] );
        echo $before_widget;
        if ( $title )
            echo $before_title . $title . $after_title; ?>
        Hello, World!
        <?php echo $after_widget;
    }

    /** @see WP_Widget::update */
    function update( $new_instance, $old_instance ) {
        $instance = $old_instance;
        $instance['title'] = strip_tags($new_instance['title']);
        return $instance;
    }

    /** @see WP_Widget::form */
    function form( $instance ) {
        if ( $instance ) {
            $title = esc_attr( $instance[ 'title' ] );
        }
        else {
            $title = __( 'New title', 'text_domain' );
        }
        ?>
        <p>
        <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> 
        <input name="<?php echo $this->get_field_name('title'); ?>" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" value="<?php echo $title; ?>" type="text" />
        </p>
        <?php }

} // class Foo_Widget

</pr?>
1141 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 2-3 years
  • Referred between 1 and 9 users
  • Sold between 10 000 and 50 000 dollars
KarmaThemes says

We do both. We add a large list of the most popular plugins for topics like social media, SEO , galleries, tranlsations etc. and just make sure they work guaranteed and if necessary skin them.

Sometimes they punch each other jQuery wise (like gTranslate never works with Sexy Bookmarks), but mostly it’s a good way since buyers will always use their own plugins regardless of how much you code yourself. So it’s always good to be able to tell them “if yours does not work, use this or that, we skinned it especially for this theme”.

All the best, Mel for KarmaThemes

2079 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 4-5 years
  • Won a Competition
+10 more
mpc moderator says

Ok, so I see it is time to develop some custom widgets :) thanks for answers!

3256 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Beta Tester
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
+4 more
ParkerAndKent says

I made something like 40 custom widgets… done one done all… are very simple.

208 posts WordPress Guy
  • Envato Staff
  • Australia
  • Has been a member for 4-5 years
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Reviewer
+1 more
Japh staff says

If there already exists a plugin on WordPress.org that I can use, I usually use that.

Actually, recently there was an article about a fantastic class you can use to automatically prompt users to install plugins you need for your theme!

The TGM Plugin Activation class on GitHub

2079 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Exclusive Author
  • Community Moderator
  • Bought between 50 and 99 items
  • Referred between 200 and 499 users
  • Has been a member for 4-5 years
  • Won a Competition
+10 more
mpc moderator says
Japh said
If there already exists a plugin on WordPress.org that I can use, I usually use that.

Actually, recently there was an article about a fantastic class you can use to automatically prompt users to install plugins you need for your theme!

The TGM Plugin Activation class on GitHub

Thanks! :)

701 posts
  • Bought between 1000 and 4999 items
  • Canada
  • Has been a member for 4-5 years
  • Referred between 1 and 9 users
chrismccoy says
Japh said
If there already exists a plugin on WordPress.org that I can use, I usually use that.

Actually, recently there was an article about a fantastic class you can use to automatically prompt users to install plugins you need for your theme!

The TGM Plugin Activation class on GitHub

works great, used this on a plugin of mine.

208 posts WordPress Guy
  • Envato Staff
  • Australia
  • Has been a member for 4-5 years
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • Sold between 100 and 1 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Reviewer
+1 more
Japh staff says

Just to let you all know, and as @mpc has noticed already, I did a quick video run through on WPTuts+ to show how you’d use this class in a theme:

Intro To TGM Plugin Activation Class For WordPress

I hope you guys find it useful! :)

by
by
by
by
by