Title: If Function Exists &#8211; &#8220;Pluginifying&#8221; my Theme
Last modified: August 18, 2016

---

# If Function Exists – “Pluginifying” my Theme

 *  Resolved [deanhatescoffee](https://wordpress.org/support/users/deanhatescoffee/)
 * (@deanhatescoffee)
 * [19 years ago](https://wordpress.org/support/topic/if-function-exists-pluginifying-my-theme/)
 * I’m designing a theme. I’d like to use if(function_exists to check if Ultimate
   Tag Warrior is installed. So, basically, I *think* that I want to do something
   like merge
 * `<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else:?
   >`
 * with
 * `<?php UTW_ShowWeightedTagSetAlphabetical("coloredsizedtagcloud","","") ?>`
 * so that it checks to see if UTW exists, and then displays that (rather than a
   sidebar), but I’m not sure which part of the PHP code is needed for if(function_exists
   to work. How can this be done? Thanks in advance. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [polyxena](https://wordpress.org/support/users/polyxena/)
 * (@polyxena)
 * [19 years ago](https://wordpress.org/support/topic/if-function-exists-pluginifying-my-theme/#post-562940)
 * Should be simple
 * if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(1) && function_exists(‘
   anyUTWfunction’) ) etc
 * but probably best to leave a note for users that UTW is required, else no widgets…
 *  Thread Starter [deanhatescoffee](https://wordpress.org/support/users/deanhatescoffee/)
 * (@deanhatescoffee)
 * [19 years ago](https://wordpress.org/support/topic/if-function-exists-pluginifying-my-theme/#post-562970)
 * Bad choice of words – I should clarify – I don’t want to actually “merge” the
   widgets sidebar and UTW; rather, I just want to use if(function_exists to say,“
   If UTW is installed then use it; otherwise, just display the regular WP categories.”
   I only mentioned the sidebar code above because that’s the only time I’ve seen
   if(function_exists in WP. Sorry about the confusion. 🙂
 * From my example
    `UTW_ShowWeightedTagSetAlphabetical("coloredsizedtagcloud","","")`
   what is the proper function in this case? Is it `UTW_ShowWeightedTagSetAlphabetical`
   or is it something else altogether?
 * Aside from knowing that if(function_exists is used for the widget sidebars, I
   know practically nothing about it, so any and all help is appreciated. My ultimate
   goal is to use if(function_exists for other popular plugins as well, just to 
   make my theme more out-of-the-box friendly.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years ago](https://wordpress.org/support/topic/if-function-exists-pluginifying-my-theme/#post-562982)
 * The function you’re actually calling is the one you should be checking for. Like
   so:
 *     ```
       <?php
       if (function_exists('UTW_ShowWeightedTagSetAlphabetical')) {
       UTW_ShowWeightedTagSetAlphabetical("coloredsizedtagcloud","","");
       }
       ?>
       ```
   
 * function_exists does more or less exactly what you’d expect it to do. If the 
   function you pass to it exists, then it returns true. So if you’re wanting to
   call function aaa(), but don’t know if that function has been declared (or that
   the aaa plugin is active), then you can check for it first. Like so:
 *     ```
       if (function_exists('aaa')) {
       aaa(parameters);
       }
       else {
       // optional: no aaa, so do something else
       }
       ```
   
 * More info:
    [http://php.net/function_exists](http://php.net/function_exists)
 *  Thread Starter [deanhatescoffee](https://wordpress.org/support/users/deanhatescoffee/)
 * (@deanhatescoffee)
 * [19 years ago](https://wordpress.org/support/topic/if-function-exists-pluginifying-my-theme/#post-562985)
 * Excellent – thanks Otto! It seems much easier than I anticipated. I’ll post back
   if I run into any issues. Thanks again. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘If Function Exists – “Pluginifying” my Theme’ is closed to new replies.

## Tags

 * [function_exists](https://wordpress.org/support/topic-tag/function_exists/)
 * [tag](https://wordpress.org/support/topic-tag/tag/)
 * [UTW](https://wordpress.org/support/topic-tag/utw/)
 * [warrior](https://wordpress.org/support/topic-tag/warrior/)

 * 4 replies
 * 3 participants
 * Last reply from: [deanhatescoffee](https://wordpress.org/support/users/deanhatescoffee/)
 * Last activity: [19 years ago](https://wordpress.org/support/topic/if-function-exists-pluginifying-my-theme/#post-562985)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
