Skip Navigation

[Résolu] tags being added to Access shortcodes

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The issue here is that the user is getting the p tags being added to the access shortcode on the frontend.

Solution:

This can be resolved by adding the raw="true" attribute to the shortcode.

This support ticket is created Il y a 6 années et 5 mois. 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Marqué : 

Ce sujet contient 19 réponses, a 2 voix.

Dernière mise à jour par Shane Il y a 6 années et 4 mois.

Assisté par: Shane.

Auteur
Publications
#919887

Whilst struggling with a layout not working as expected, I've noticed via my browser's inspection tool that Access shortcodes are being wrapped in <p> tags. So, this shortcode in the editor in wp-admin:-

[toolset_access role="Guest" operator="allow"]hello[/toolset_access]

has unwanted space below it on the frontend (margin set by CSS) and I see this via the inspection tool;-

<p>hello</p>

This didn't used to happen. I'm not using Layouts and I'm using Astra theme. I've deactivated all plugins then reactivated just Types & Access and the problem persists. I've also checked another site of mine and the issue exists there too.

Please advise. Thanks.

#919947

PS: I've tried adding output="raw" to shortcode but that's not having any effect

#920036

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Julie,

Thank you for contacting our support forum.

Are you currently displaying this using a content template?

If so then there should be an option there to disable auto paragraphs.

If this does not work then you can try this shortcode below.
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-noautop

Please let me know if this helps.
Thanks,
Shane

#920043

Hi Shane

Thank you for your suggestions but my Content Templates are already set to 'manual paragraphs'. I've tried using wpv-noautop as you suggest but that didn't work either.

🙁

#920063

I've just been trying a couple of things and I've worked out that the <p> tags are being added if the content isn't already inside <p> or <div> tags.

I don't ever recall Access shortcodes behaving like this. Is this something new or am I imagining that I could prior to Types 3.0 place Access shortcodes mid sentence to display a different word to different users according to role like this:-

<p>Please wear a [toolset_access role="Guest" operator="allow"]red[/toolset_access][toolset_access role="Contributor" operator="allow"]blue[/toolset_access] shirt</p>

without <p> tags automatically appearing and therefore displaying this content like this:-

Please wear a

blue

shirt

??

#920065

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Julie,

I don't recall this either because the p tags should not be added.

Its possible that your theme is adding it. What you can try is to use the wpv-noautop shorcode within the access shortcode and let me know if this helps.

Thanks,
Shane

#920152

Hi Shane

No, that makes no difference. I've also deactivated Astra and tried it with 2017 - the p tags are still being added. Please advise.

#920349

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Julie,

Would you mind providing me with admin access to this website so that I can take a look?

The private fields have been enabled for your next response.

Thanks,
Shane

#920874

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Julie,

I think the best way to provide me with a copy of the site is to use the duplicator plugin.

To do this please follow the instructions in the link below.
https://toolset.com/faq/provide-supporters-copy-site/

Thanks,
Shane

#921062

I'm not clear about how I can be logged in to my site to use Duplicator when I've anonimised personal data in the database using the query provided by Toolset ??? Are you not able to work at all with what I've provided already?

#923621

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Juilie,

I was able to see this issue and have reported this to our team for further checking.

Thanks,
Shane

#923750

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Julie,

Could you try adding the attribute raw='true' to the shortcode and this should remove the p tags.

Thanks,
Shane

#923870

Hi Shane

Well I'm relieved it's not just me!

I have already tried using raw attribute (see thread #919947 - second from top).

#924356

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Julie,

I want to have a further look at this but I need an exact clone of your site so that I can check further.

Would it be possible to create a duplicator package of your site so that I can test it locally here ?

To do this please follow the instructions in the link below.
https://toolset.com/faq/provide-supporters-copy-site/

Thanks,
Shane

#924983

Are you saying that the problem (which you have successfully replicated) goes away for you when you add the 'raw' attribute to the toolset_access shortcode?