Testing if Clean Archives Reloaded exists
-
Greetings,
Thank you for providing this great plugin! It is very handy!
Here is my question:
I am using the following code in my archives.php template to test for whether Clean Archives Reloaded exists or not, and if it does, then use it, and if it does not, fall back to a simple monthly listing.<?php if(function_exists('clean_archives_reloaded')){ echo'<h1>Blog Archives</h1>'; echo apply_filters( 'the_content', '[cleanarchivesreloaded]' ); } else{ echo'<h1>Archives by Month</h1><div class="archive_by_month"><ul>' . wp_get_archives('type=monthly&show_post_count=1&echo=0') . '</ul></div>'; } ?>
As you can see, I am testing for the existence of the function “clean_archives_reloaded”; I am wondering if this is the best method and/or function to use, or if there is a different clean archives reloaded function that would be better to test for? I ask because I know that code can get changed over time and so I want to pick something that is likely to always exist in the plugin.
Also, the reason for wanting to test for the plugin first is because there are occasions where I need to disable most/all of my plugins (eg, when upgrading, troubleshooting problems with others plugins, etc.) and when that is the case I want the user to still arrive at a somewhat useful page (instead of just seeing the shortcode).
Thanks much in advance for your input!
??https://www.ads-software.com/extend/plugins/clean-archives-reloaded/
- The topic ‘Testing if Clean Archives Reloaded exists’ is closed to new replies.