go41

site breaks (stops) after deactivation of a plugin

von Joern am 12. Okt. 2009 | Keine Kommentare

There are plugins for WordPress which show automatically after the_content. If you do not like this location of display you can insert a code in your template file like single.php or index.php to call the plugin. Make sure you switch off the auto-function.
Example: Sociable Zyblog Edition

Use the admin panel to turn off the display on all pages and insert in the template file in your preferable location this: <?php print sociable_html(); ?> Right? NO, not really. If you deactivate the plugin your page will stop on just this line because this function is not known anymore.
You should always use he PHP check ‚if function_exists‘ and only load it if its available. Correct code for manually inserting the Sociable Zyblog Edition plugin display is:

Code:

<?php if (function_exists('sociable_html')) {
    echo sociable_html();
} ?>

On deactivation of the plugin it would just do nothing.
The same applies to ‚Yet Another Related Posts Plugin‘ which you also can call on another location if you do not use the Auto display function. The author suggests to use: <?php related_posts(); ?> for Manual installation with a yarpp-template-xx.php template in yout theme folder.

Better would be to check for the existence of this function first, so I recommend to use:

Code:

<?php if (function_exists('related_posts')) { related_posts(); } ?>

Yet Another Related Posts Plugin is a really great thing btw!!
This php if (function_exists(.. should be used for all plugin related functions you insert into your templates.
Looking on my header.php I find more examples:

Code:

<?php if (function_exists('the_thumb'))  { ?>
do thumbnail stuff ..
<?php } //the thumb ?>

or

Code:

<?php if (class_exists('SimpleTags')) { ?> | <?php st_the_tags(); ?><?php } ?>

or in other templates

Code:

<?php if (class_exists('SimplePie')) { ?>
get a feed ..
<?php } // end SimplePie ?>

or

Code:

<?php if (function_exists('searchphrases')) : ?>
<?php searchphrases(); ?>
<?php endif; ?>

or

Code:

<?php if(function_exists('the_views')) { the_views(); } ?>

or

Code:

<?php if(function_exists('the_ratings')) { the_ratings(); } ?>

just to give you some advice
____________________
you find me on Google+, Twitter and Facebook

(von: Joern)

Hier noch 10 weitere Ergebnisse dieses Threads:

Creating Customized Menus

22. Okt. 2011 (von: kinyofu)

Hi Joern,Long time. Hope you are well.I am using Arthemia for another site. I added some code to create Custom Menus as Arthemia does not support them.I am having trouble with my navigation bar. I wish to only have 3…

Re: Creating Customized Menus :: Reply by Joern

22. Okt. 2011 (von: Joern)

Hi Kinyofu,looking at your new site I see you got your custom menu working but the 'old' menu is still there. It's not possible to make invisible like this:/**deleted this ...backup this header.php and really delete the stuff you do…

TimThumb Question

22. Okt. 2011 (von: sdn001)

I saw the post about TimThumb exploits and the fact that you've removed all themes using TimThumb from your site based on that.I have a WordPress site I am building based on your arthemix-bronze theme, but I have put a…

Re: Creating Customized Menus :: Reply by kinyofu

22. Okt. 2011 (von: kinyofu)

Thank Joern, as usual you are the best.I LOVE THE THEME YOU RECOMMENDED.Kinyofu Weiterlesen →

Re: TimThumb Question :: Reply by Joern

22. Okt. 2011 (von: Joern)

I had some demo themes with timthumb on my demo site and was using the latest script in july '11 ('VERSION', '1.11').In august I found .php files in the themes /cache folder, while there should be only images...Sure, first thing…

Re: Creating Customized Menus :: Reply by Joern

22. Okt. 2011 (von: Joern)

Had to look at your new site - looks great!It's a really clean theme, isn't it?____________________you find me on Google+, Twitter and Facebook Weiterlesen →

Upgrading this forum from bbpress 0.9.0.5 to bbpress 1.1

23. Okt. 2011 (von: master)

I just upgraded the forum software used here from version 0.9.0.5 to bbpress 1.1Actually bbpress is now available a plugin for WordPress, bbpress 2.0 plugin, which might be the next step for me. As it is not possible to import/convert…

Re: Creating Customized Menus :: Reply by kinyofu

23. Okt. 2011 (von: kinyofu)

Yes, and versatile with set up instruction. Thanks for sharing.Kinyofu Weiterlesen →

Re: Upgrading this forum from bbpress 0.9.0.5 to bbpress 1.1 :: Reply by Joern

24. Okt. 2011 (von: Joern)

this forum is running now on bbPress 1.1, but I get the feeling as if the support for bbPress has stopped long time ago ..If I want to logout from the dasboard, I get a blank page, why?Searching the web…

Re: Upgrading this forum from bbpress 0.9.0.5 to bbpress 1.1 :: Reply by f-t-cat

7. Nov. 2012 (von: f-t-cat)

delete posts and deleted topics permanently from the database worked for me today!I followed your steps above:First 'delete' all spam topics in your forum dashboard to get marked as deleted(BACKUP FIRST by EXPORTING, WHO KNOWS)Second delete all posts i... Weiterlesen…

Autor:

Du findest mich auch auf Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.


Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.

weitere forum Beiträge: