• Resolved Jon

    (@omanhene)


    I have discovered a small bug in the Spoiler shortcode when using several spoilers in a row. I can easily work around it by not putting HTML comments in-between Spoilers, but I thought it might be representative of a larger issue, so I will share it in case it is useful for other reasons.
    Here is the issue….
    When using the Spoiler shortcode and stacking several of them together, I see a strange behavior.

    1) Stacking them with no code between them works fine.
    2) Stacking them with a generic HTML comment like this, is also fine.
    [su_spoiler title=”Q1What is a comparable sale?”]
    <p>Answer goes here….</p>
    [/su_spoiler]
    <!– generic html comment –>

    [su_spoiler title=”Q2What is a comparable sale?”]
    <p>Answer goes here….</p>
    [/su_spoiler]
    <!– generic html comment –>’

    3) But if I put in this particular HTML comment (<!– wp:paragraph –>) in between Spoilers, it breaks the looping and gives me repeated entries. For example the code below gives me Spoilers Q4, 5, 3 4,5,2,3,4,5, then redisplays the entire page again with the correct sequence of 1,2,3,4,5.

    Try pasting this code in and see what I mean. It does not seem to be Theme related. I can reproduce it on several of my sites. The

    [su_spoiler title="Q1What is a comparable sale?"]
    <p>Answer goes here....</p>
    [/su_spoiler]
    <!-- wp:paragraph -->
    
    [su_spoiler title="Q2What is a comparable sale?"]
    <p>Answer goes here....</p>
    [/su_spoiler]
    <!-- wp:paragraph -->
    
    [su_spoiler title="Q3What is a comparable sale?"]
    <p>Answer goes here....</p>
    [/su_spoiler]
    <!-- wp:paragraph -->
    
    [su_spoiler title="Q4What is a comparable sale?"]
    <p>Answer goes here....</p>
    [/su_spoiler]
    <!-- wp:paragraph -->
    
    [su_spoiler title="Q5What is a comparable sale?"]
    <p>Answer goes here....</p>
    [/su_spoiler]

    this particular comment was inserted by wordpress, probably visual editor or a gutenberg block, I did not create it originally, just copied it.

  • The topic ‘Spoiler Shortcode bug? – Remove HTML Comments between Spoilers to fix’ is closed to new replies.