• Resolved whitesea

    (@whitesea)


    Hi everyone,

    I’m still new to WordPress development so please be kind 🙂

    I’m using the echo do_shortcode function within my custom template page to call the plug-in (I think this is the right terminology…). It’s been extremely finicky. I have the shortcodes in a FAQ div with two columns/floated divs. Each FAQ question looks like this:

    <h3 class="process-title"><?php echo do_shortcode( '[expand title="What kind of payment do you accept?"]At the moment we only accept payment by check.[/expand]' ); ?></h3>

    The weird thing is, when I add a new question, sometimes it’ll return a blank page. But it’s only my website that goes blank, NOT the admin, as is per usual with a broken function.

    Also, it’ll only do this sometimes, and I cannot figure out or predict why it chooses to do that, or NOT do that. I copy and paste the exact same line that previously worked, and sometimes it’ll work again, and sometimes it’ll go blank.

    Is it an issue with the function? With my divs? Any idea?

    Thank you in advance.

    https://wordpress.org/plugins/jquery-collapse-o-matic/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Baden

    (@baden03)

    what editor are you using to edit the template files?

    Thread Starter whitesea

    (@whitesea)

    Baden, I’m editing the files directly in the WordPress editor. Is this wrong? :/

    Plugin Author Baden

    (@baden03)

    this is very strange. you paste the exact same code and save and sometimes you get a white screen… you might want to set wp_debug to true in your wp-config file to see if that gives you any more details on what in the wide-world of sports is a’going on.

    Thread Starter whitesea

    (@whitesea)

    Okay, I set it up and this came back:

    Parse error: syntax error, unexpected ‘t’ (T_STRING) in **my theme page** on line 86.

    Any ideas?

    Thread Starter whitesea

    (@whitesea)

    Hold on, let me find the line in question.

    Thread Starter whitesea

    (@whitesea)

    Well, I figured it out. Any apostrophes used in the expanded text causes an error. Just removed them all and it went back to working.

    Do you know of any way around this, Baden?

    Thread Starter whitesea

    (@whitesea)

    I don’t know if I was clear before, but I edit my custom templates in the editor under Appearance, not within the page’s text editor.

    I experimented by using the original shortcode, sans the function, inside the actual page’s text editor, and it worked just fine with apostrophes put in.

    So, the do_shortcode function causes a syntax error when apostrophes are used.

    Plugin Author Baden

    (@baden03)

    can you share an example of how you are using do_shortcode with apostrophes?

    Thread Starter whitesea

    (@whitesea)

    Example:

    <h3 class="process-title"><?php echo do_shortcode( '[expand title="What kind of payment do you accept?"]At the moment it's our policy to only accept payment by check.[/expand]' ); ?></h3>

    The apostrophe in “it’s” causes a syntax error.

    Plugin Author Baden

    (@baden03)

    yes, easy fix: you need to escape the apostrophes because php is looking at it as the end of the do_shortcode argument. Try this:

    <h3 class="process-title"><?php echo do_shortcode( '[expand title="What kind of payment do you accept?"]At the moment it\'s our policy to only accept payment by check.[/expand]' ); ?></h3>
    Thread Starter whitesea

    (@whitesea)

    Baden, thank you!! I didn’t know about that, but it makes total sense.

    I ended up transferring my template content to the text editor and using <?php the_content(); ?> to fill it in. Turned out to be a major headache. Wish I would’ve waited for your reply! 😛

    Thanks again, I really appreciate it.

    Plugin Author Baden

    (@baden03)

    Live and learn… we’ll mark the issue as resolved. Hit us back if you require any further assistance. If you like the plugin or the support: why not vote for pedro?

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

The topic ‘do_shortcode returning blank page’ is closed to new replies.