• Resolved cmrivera

    (@cmrivera)


    If I use your shortcode on a page from the admin section, your plugin works just fine demonstrating the theme is set up okay. Your javascript file is just before the end Body tag.

    However, if I add your shortcode to a custom page that has a custom query, it parses the titles okay, but doesn’t add structural html to anything.

    My code on the custom page is basically like this:
    <?php do_shortcode (‘[accordion]’); ?>
    — start the loop code here —
    <?php do_shortcode (‘[accordion-item title=”‘. the_title() . ‘”]’); ?>
    my contents here
    <?php do_shortcode (‘[/accordion-item]’); ?>
    — end of the loop code here —
    <?php do_shortcode (‘[/accordion]’); ?>

    Source code of the custom page has this near the end body tag:

    <script type=’text/javascript’>
    /* <![CDATA[ */
    var accordionShortcodesSettings = [{“id”:”accordion-1″,”autoClose”:true,”openFirst”:false,”openAll”:false,”clickToClose”:false,”scroll”:false}];
    /* ]]> */
    </script>
    <script type=’text/javascript’ src=’https://MYDOMAIN-HERE/wp-content/plugins/accordion-shortcodes/accordion.min.js?ver=2.2.4′></script&gt;

    Any ideas why the html isn’t being added?

    Thanks.
    Chuck

    https://www.ads-software.com/plugins/accordion-shortcodes/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter cmrivera

    (@cmrivera)

    I ran a test with your basic example outside of the loop and it was not get processed. Here’s what I ran:
    $mycontent =
    ‘[accordion]
    [accordion-item title=”Title of accordion item”]Drop-down content goes here.[/accordion-item]
    [accordion-item title=”Second accordion item”]Drop-down content goes here.[/accordion-item]
    [/accordion]’;
    do_shortcode ($mycontent);

    Result was blank.

    Plugin Author philbuchanan

    (@philbuchanan)

    Try using

    echo do_shortcode($mycontent);

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom page, custom query’ is closed to new replies.