Title: Short code in PHP
Last modified: August 22, 2016

---

# Short code in PHP

 *  [fabone](https://wordpress.org/support/users/fabone/)
 * (@fabone)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/short-code-in-php/)
 * Hello,
 * I would like to choose a particular [short code] (from other plugins) following
   a PHP variable.
 * For example, i would like to do this in PHP :
    <?php if ($var=”1″) { echo ‘<p
   >[short code 1] </p>’; } else { echo ‘<p>[short code 2] </p>’; } ?>
 * Same kind of question : Is it possible to create for example 2 PHP shortCode 
   with yout plugin and put the first in the second and the second in the first ?
 * With regards.
 * [https://wordpress.org/plugins/php-snippets/](https://wordpress.org/plugins/php-snippets/)

The topic ‘Short code in PHP’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/php-snippets.svg)
 * [PHP Snippets](https://wordpress.org/plugins/php-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/php-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-snippets/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [fabone](https://wordpress.org/support/users/fabone/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/short-code-in-php/)
 * Status: not resolved