• Resolved Clancy Bird

    (@clancy-bird)


    I have set up two shortcodes in the Shortcode Exec PHP Administration. Both are enabled and echoed. When tested, both return the results I expect with no errors.

    I have WordPress 3.9.2, and the installed Shortcode plugin is 1.49 (I know about 1.51 but the site is large – I will to update some time in the future).

    Now, I have page – lets call it thispage, and the two shortcodes – [A] and [B]. I insert [A] into thispage with [B] just below it. [A] executes fine, but [B] is showing as [B]?. I believe this is because;

    My shortcode appears with a question mark behind it

    The post or page author has insufficient privileges to execute shortcodes.

    I can swap [B] to be first, but I get the same error – just this time it is [A]?.

    Is something to do with having too many shortcodes on the page?

    Here is the code;

    the_post();
    
    $filtered_posts = get_view_query_results('320');
    echo '<div class="responsive_tab" id="business_feature_tabs">';
    echo '<ul>';
        $count = 0;
        foreach ($filtered_posts as $filtered_post) {
            $count++;
            $icon       = get_post_meta( $filtered_post->ID, 'wpcf-icon', true );
            $alt_tag    = get_post_meta( $filtered_post->ID, 'wpcf-alt_tag', true ) ? get_post_meta( $filtered_post->ID, 'wpcf-alt_tag', true ) : $filtered_post->post_title;
            echo '<li class="business_featuretab_anchor_'.$count.'"><a href="#business_featuretab-'.$count.'"><img alt="'.$alt_tag.'" src="'.$icon.'" /></a></li>';
        }
        echo '</ul>';
        $count = 0;
        foreach ($filtered_posts as $filtered_post) {
            $count++;
            $learn_more = get_post_meta( $filtered_post->ID, 'wpcf-learn_more', true );
        echo '<div id="business_featuretab-'.$count.'">';
        echo '<div>'.$filtered_post->post_content.'</div>';
        echo '</div>';
        }
    echo '</div>';

    The second shortcode is identical, but with get_view_query_results('320') as get_view_query_results('310').

    https://wordpress.org/plugins/shortcode-exec-php/

Viewing 1 replies (of 1 total)
  • Thread Starter Clancy Bird

    (@clancy-bird)

    I had the_post(); in both shortcodes, and therefore it was breaking when it was trying to run twice (once for each shortcode). Removing the call to the function has resolved the mistake.

    Thank you! Keep up with the great plugin.

Viewing 1 replies (of 1 total)
  • The topic ‘Two or more shortcodes on a page’ is closed to new replies.