• Resolved Peter Berger

    (@peterpolow)


    Hello Eliot,

    The storm of the WP 4.2.3 update is over, isn’t it? CCS 2.7.1 looks like a stable version (for me)…

    I experience only one small issue. I wrote about it in the last thread I started (about the content shortcode in a post-template file), but maybe you missed it.

    From version 2.6.8 there appears a visible shortcode [protect][/protect] above some content. When I look into the html source code, I see the shortcode appears around <script>...</script>. But not around all scripts. Only in the case when I get the content using a [content] shortcode to get other shortcodes from a custom field.

    I use it like this:

    In the (header) area where I see the [protect] shortcode. I use [content type="template" name="sponsor-carousel-header" field="html"].

    In the custom field “html” from the post (template) “sponsor-carousel-header” I have this code:

    <script>
    $(document).ready(function(){
      $('.sponsor-carousel-header').bxSlider({
        auto: 'true',
        autoHover: 'true',
        speed: 700,
        pauze: 500,
        slideWidth: 200,
        moveSlides: 2,
        pager: false,
        minSlides: 2,
        maxSlides: 3,
        controls: false,
        slideMargin: 10,
      });
    });
    </script>
    
    <ul class="sponsor-carousel-header">
    [loop type="sponsor" field="status_sponsor" value="actief" orderby="rand"]
    <li style="display: inline;">
    <a href="[field website_sponsor]" target="_blank" title="[field title]">[field image="logo_sponsor" size="sponsor-logo-medium" image_class="aligncenter"]</a>
    </li>
    [/loop]
    </ul>

    If I use [js] in place of <script>, then the [protect] shortcode disappears.

    Do you know what’s the cause is en how you can fix it?

    Thanks in advance!

    Peter

    https://www.ads-software.com/plugins/custom-content-shortcode/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Eliot Akira

    (@miyarakira)

    Are you using do_shortcode to load the template? If so, could you try do_ccs_shortcode?

    This [protect] is a new feature I’m trying, to protect square brackets inside scripts from getting interpreted as shortcodes. I’m not quite happy with how it works, to be honest, so I may remove it if I can find a better solution.

    Yes, after close to 20 updates, it looks like the plugin is finally back to stable.

    Thread Starter Peter Berger

    (@peterpolow)

    Thanks for the reply, Eliot.

    No, in this case I don’t use do_shortcode. I use it in an “ad banner area” in the header of the theme I use.

    If I add the same “content-shortcode” to the regular content field of a page, then I see also the [protect] shortcode. The difference with the code in the “ad banner area” is that in the header appears a double shortcode ([protect][protect][/protect][/protect]) and in the page content just one.

    Hi Peter and Eliot,

    I’m having this issue as well… Here’s the thread where we were previously posting about this.

    The only thing that has changed for me with this latest update is, as Peter says, that the [protect] shortcode appears twice when called from a PHP file as opposed to only once when called from within the_content. However, I was away for the weekend so the last version I tried before this one (2.7.1) was 2.6.8, and so I don’t know what happened in between…

    This is resolved with the latest update. Thank you, Eliot ??

    Sorry, but now I notice that [direct][/direct] is wrapped around fields containing scripts, but only when called from a php file. All’s good when the field is called from within the_content… (Which is why I thought it was resolved — I thought I checked both cases but I guess not…)

    Thread Starter Peter Berger

    (@peterpolow)

    Thank you for the update, Eliot!

    Unfortunately it’s not really resolved. Now appears [direct][/direct] (not twice) in place of [protect][/protect] around <script>...</script>. And now not only when I get the shortcodes (with script) via a [content] shortcode, but also when I have <script> above shortcodes in a text-widget.

    The [direct] or [protect] shortcode does not appear anymore when I put the [content] shortcode in the default content area of a page.

    Same thing happening on my end with the [direct] and [/direct] shortcodes appearing in widget areas.

    Thread Starter Peter Berger

    (@peterpolow)

    Version 2.7.3 resolved it! ??

    Thanks again, Eliot!

    P.S. Your plugin makes building websites so much fun! If I ever could do anything for you, please let me know!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[protect][/protect] appears around script’ is closed to new replies.