Navigation überspringen

[Gelöst] Shortcode seems to work inside tag but not inside tag

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:

"Advanced Ads" plugin does not support using types shortcode within HTML script tag.

Solution:

You can try with PHP codes, for example:

https://toolset.com/forums/topic/shortcode-seems-to-work-inside-tag-but-not-inside-tag/#post-1650047

Relevant Documentation:

https://developer.wordpress.org/reference/functions/do_shortcode/

This support ticket is created vor 4 Jahren, 7 Monaten. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 6 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von AlimB3245 vor 4 Jahren, 7 Monaten.

Assistiert von: Luo Yang.

Author
Artikel
#1648271
Screen Shot 2020-06-03 at 11.05.37 AM.png

I am trying to: I've created an ad using Advanced Ad's plugin with the script pasted below and assigned it to appear after the 7th para on Custom Posts Article.. The <a> part renders fine but while i've use the same short code within the <script> tag in the code it doesn't seem to work.. I had created a ticket for this but the support didn't seem to understand it and hence this bug ticket
ParfumPlus Arabia

<script async defer src="[types field='flipbook-url' item='@issue-article.parent' output='raw'][/types]html/static/embed.js?uni=5c68db31edf1cd823e4cc281e33de80d"></script>

Link to a page where the issue can be seen: versteckter Link (What you can see after the 4th para is a working ad but what you see after the 7th para is the buggy one..

Here's a link to the earlier support ticket where the supporter created a completely different scenario ... https://toolset.com/forums/topic/types-field-inside-a-script-for-advanced-ads/

I've connected with Advanced Ads team too and they mentioned it's not a big from their side.. and they'd be happy to help if required

I expected to see: The flipbook view that the <script> tag is supposed to display

Instead, I got: Just what appears in the <a> tag.. the text 'ParfumPlus Arabia' with the link.

#1648613

Hello,

I have tried the codes as you mentioned above in my localhost:

<script async defer src="[types field='flipbook-url' item='@issue-article.parent' output='raw'][/types]html/static/embed.js?uni=5c68db31edf1cd823e4cc281e33de80d"></script>

It works fine, if you are using Blocks Editor, I suggest you put above codes into a shortcode block and test again, see WP document:
https://wordpress.org/support/article/shortcode-block/

#1649787
Screen Shot 2020-06-04 at 11.34.42 AM.png

Hi Luo Yang

As you are accessing the site for the other ticket could you please check for this issue to?

The Ad In Advanced Ads is here..

versteckter Link

(screenshot attached that shows the working ad and the non-working ad)

Both these ads appear here..
versteckter Link

The working ad is the image (after the 4th Para) and the non-working ad is the text 'ParfumPlus Arabia' after the 7th Para..

Regards,
Alim

#1650047

It seems that the problem is in plugin "Advanced Ads", it does not support using types shortcode within script tag, I have done below modifications in your website:
Edit ad: PP Flipbook Feeds Not Working
versteckter Link
1) Change the codes with PHP codes:

<script async defer src="<?php echo do_shortcode("[types field='flipbook-url' item='@issue-article.parent' output='raw'][/types]");?>html/static/embed.js?uni=5c68db31edf1cd823e4cc281e33de80d"></script>

2) Enable option:
Allow PHP

Test it in front-end, it works fine:
versteckter Link

More help:
https://developer.wordpress.org/reference/functions/do_shortcode/

#1650257
Screen Shot 2020-06-04 at 5.11.56 PM.png

Hi Luo Yang

The link doesn't seem to work on the front end.. please check screenshot .. there's an error message on the ads view...

Is it the two opening quotes that are clashing... before the php code opening and the types opening?

<script async defer src="<?php echo do_shortcode("[types

Please advise..

Regards,
Alim

#1650271

It does work in front-end, please check the source codes of below URL:
view-source:versteckter Link

Line 842:

<script async defer src="<em><u>versteckter Link</u></em>"></script></div>

Can you confirm it?

And for "the error message on the ads view" you mentioned above, it is a problem of your plugin "Advanced Ads", you will need to check the "Advanced Ads" plugin author for it.

Those error message don't take effect on front-end, and the PHP codes is correct.

#1650305

My issue is resolved now. Thank you!

Thanks Luo Yang... Yes you are right.. it's showing fine..:-)..

I'll follow up with the Advanced Ads team for the rest.

Have a nice day..:-)..

Regards,
Alim