WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a shortcode [API-Module version="1"] and another shortcode like [API-Module version="2"]

If i handle any one at a time in a single page it works perfectly. Yet my requirement needs both had to be visible in front end(UI) when handling two shortcodes. Is there any possibilities to do so ?

Constructor to add short-code:

function __construct() {
            add_shortcode('API-Module', array(&$this, 'handle_shortcode'));

This part is used in handling short-code:

 function handle_shortcode($atts) { 
 $version_type = $atts['version'];
    require_once "/front_end/view/api-list.php"; 
    return $output_string;  
share|improve this question
There is no limit to the number of shortcode (even same shortcode) in a page. If it doesn't work there is a problem in the function that handle the shortcode. Post it to have chance of any help... – gmazzap Sep 21 '13 at 11:42
Post it in the question. And post (the relevant part) of api-list.php. This code -pratically- do nothing. – gmazzap Sep 23 '13 at 12:49
up vote 1 down vote accepted

From the PHP Manual on require_once:

The require_once statement is identical to require except PHP will check if the file has already been included, and if so, not include (require) it again.

The second time your shortcode handler is run, the view/template will not be executed.
Hence no output.

require_once "/front_end/view/api-list.php";
require "/front_end/view/api-list.php";
and you ought to be fine.

share|improve this answer
Thank you so much it worked !! – ram Sep 23 '13 at 13:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.