Get fresh WordPress Content delivered in your inbox with warpspeed!

learn wordpress wplift wordpress rocket

WPCandy talked about building a functionality plugin which is to take functions that could be added to your theme's functions.php file and making a plugin out of them so if you change themes you won't lose any essential functionality ( like shortcodes etc).

But what if you want to do the opposite and take a plugin's functionality and build it directly into your theme? That's the subject of this quick guide - I will show you how to take a Twitter widget plugin and make it part of your theme.

The Plugin File

The plugin we will be using is DP Twitter Widget, what this plugin does is add a new widget which you can display your tweets live on your site. Download the plugin and unzip the file. Inside the zip you will see several files, the one we need is called dp-twitter-widget.php. Within your theme directory, create a new folder and call it "widgets" and upload this file to there.

Theme Functions.php

Now open your theme's functions.php file and add the following line to it to call the plugin file :

[php]
require_once('widgets/dp-twitter-widget.php');
[/php]

Save your functions.php file and upload.

The Widget

Now within your WordPress admin panel, visit "Appearance" > "Widgets" and you should see an extra widget has been added :

Published:

Last updated on:

Oliver Dale is the founder of Kooc Media, An Internet Company based in Manchester, UK. I founded WPLift and ThemeFurnace, find out more on my Personal Blog. Thanks!

3 thoughts on “Build a Plugin (Twitter Widget) into your WordPress Theme

  1. I had follow all your steps, but what had happened is that I cannot access my blog.
    Warning: require_once(widgets/dp-twitter-widget.php) [function.require-once]: failed to open stream: No such file or directory in /home/username/public_html/wp-includes/functions.php on line 3699

    Fatal error: require_once() [function.require]: Failed opening required ‘widgets/dp-twitter-widget.php’ (include_path=’.:/usr/lib/php:/usr/local/lib/php’) in /home/username/public_html/wp-includes/functions.php on line 3699

    help!

    • i uploaded db-twitter-widget.php into public_html/wp-content/themes/europe/widgets. Is this correct? Then I copied the code into functions.php at the bottom of the script. Do i need to upload the plugin zip into wp-includes/plugins? I lost my blog. Help!

Comments are closed.

Join 40,000 WordPress Astronauts
AND GET OUR LATEST CONTENT IN YOUR INBOX WITH WARPSPEED

We will never spam you.
close-link
siteground coupon
Get 60% Off the No. 1 WordPress Hosting!