Saltar navegación

[Resuelto] types field inside a script for advanced ads

This support ticket is created hace 4 años, 8 meses. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por AlimB3245 hace 4 años, 7 meses.

Asistido por: Minesh.

Autor
Mensajes
#1642553

Tell us what you are trying to do? I have some code that I am inserting inside an ad created in advanced ads.. here's the script

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

you will notice 2 type fields withing the <a> tag and 1 within the <script> tag.. the 2 type fields in the <a> tag are being converted into the custom field values properly .. however the one withing the <script> tag is not taking the value of the types field even though it's exactly the same as the first one..

enlace oculto

You will see the bland area with the text in h1 saying "Please check above in source code. Not sure why the short code is not working." to help you identify the part you need to check the source code when it appears on the page.

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site? enlace oculto

#1643189

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I am not sure where exactly you added the code you shared but I just checked with my test install and added the same code you shared within the "Fields and Text" block and the following content is added to the "Fields and Text" block and I can see the shortcode is rendered successfully.

 <script async="" defer="" src="[types field='stud-url' item='@student-product.parent'][/types]html/static/embed.js?uni=5c68db31edf1cd823e4cc281e33de80d"></script>

You can see it with the following page url:
=> enlace oculto
[check the page source near the URL ===> word at the bottom of the page]

If you want to see how its configured, you can see login to site:
=> enlace oculto
Username: admin
Password: Admin@999

This is the content template where the "fields and text" block is added:
=> enlace oculto

If it does not work for you I suggest you should try to create a custom shortcode:

function func_display_dynamic_script( $atts ) {
   
  $script = "<script async defer src='".$atts['field']."html/static/embed.js?uni=5c68db31edf1cd823e4cc281e33de80d'></script>";  

  return $script;
}
add_shortcode( 'display_dynamic_script', 'func_display_dynamic_script' );

And call the above shortcode as given under:

[display_dynamic_script  field="[types field='flipbook-url' item='@issue-article.parent' output='raw'][/types]"]
#1645765

My issue is not resolved now. I am not using fields and view so your solution does not work for my example.. I thought I had provided all the requirements for you to diagnose.

I was using the code from advanced ads and for some reason it was displaying the shortcode properly in <a> tag and not in <script>...

If you use a completely different scenario and make it work, it really doesn't solve my issue ..;-)...

Thanks for your time anyways.

Regards,
Alim