Secure Include Plugin In WordPress

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); ?>

Posted

in

by

Comments

3 responses to “Secure Include Plugin In WordPress”

  1. […] :14 Stunden nach der Veröffentlichung fand ich dies -also bin ich nicht die einzige mit der Idee gewesen-schön sowas. Auch da sind einige […]

  2. Richard Avatar
    Richard

    Is it possible to run more than 1 feed in a template page?

    I tried a table with 3 feeds, only 1 showed up.

  3. Frank Avatar

    @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.