Secure Include Plugin In WordPress
October 13th, 2008 by Frank • WordPress Themes • 3 Comments
Some people use more and other less Plugins in WordPress. but it is allways advisable to check via code if a Plugin is active or not. That makes sure the theme wouldn't break if the Plugin is not active. It's pretty easy to include a little bit code to check for inactivity. I show you an example where I use it in my Plugin RSSImport.
<?php if ( function_exists('FUNCTIONSNAME') ) : ?>
...
<?php endif; ?>
Example for Plugin RSSImport:
This is how the function looks like in the code of the Plugin RSSImport.
...
function RSSImport($display=0, $feedurl, $displaydescriptions=false, $truncatetitle=true) {
if ( $feedurl ) {
...
<?php if ( function_exists('RSSImport') ) : ?>
<?php RSSImport(10, "http://feeds.feedburner.com/WpEngineer", false, false); ?>
<?php endif; ?>
or a little bid smaller
<?php if ( function_exists('RSSImport') )
RSSImport(10, "http://feeds.feedburner.com/WpEngineer", false, false); ?>
Info
- Published in WordPress Themes
- Tags: PHP, Plugin, WordPress, WordPress Plugins, WordPress Tutorials
- Comment feed | Trackback URL
- read: 5951 | today: 5
- leave a Comment



Is it possible to run more than 1 feed in a template page?
I tried a table with 3 feeds, only 1 showed up.
@Richard: yes, you can use many feeds an your site. The link for browser and users must stay in the in the head of the theme.