Home › Toolset Professional Support › [Resolved] Shortcodes don't work at all
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.
Our next available supporter will start replying to tickets in about 2.25 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 16 replies, has 2 voices.
Last updated by Rita 6 years, 2 months ago.
Assisted by: Nigel.
Hi
I am creating a website in the same way as I usually do and for some reason, this time, no shortcodes will display in any way either directly in the page content editor or in a content template.
Views shortcodes, post templates, cred form shortcodes, user login form shortcode, custom field shortcodes in templates don't render - in fact no TOOLSET shortcodes work at all. However, [wpv-post-body view_template="None"] does for example.
The shortcode itself displays instead of pulling the content.
To try to find the problem I have tested:
1. swapped to various native wordpress themes (the theme I want to use is 'Astra').
2. deactivated all other plugins except toolset plugins.
3. deactivated all other toolset plugins.
4. changed php version from 7.0.31 down to 5.6.37.
5. deleted views and installed the previous 3 versions one at a time.
6. checked if shortcodes render on various browsers; firefox, chrome and safari.
The only thing I found was if I changed the php version to 5.6.37 the site crashed with a 500 server error.
If I then deactivated the wp-views plugin the site would work again AND cred form shortcodes work too!
If I then activate the views plugin the site crashes with 500 server error.
Then, return php version to 7.0.31 the site works but, again, no TOOLSET shortcodes.
VERY STRANGE INDEED... I haven't a clue what to do next...
Hoping you may have an idea!
Regards
Rita
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rita
You are not seeing any useful messages in your debug.log? What about the fatal PHP error (the 500 server error).
If you are early in the process of creating a new site I would try with a fresh install and newly installed plugins, and then if you have already created post types, views, etc., I would use Toolset > Export / Import tools to set up the same on the new version of the site.
If you already disabled *all* other plugins and switched theme it must be something pretty fundamental, possibly a problem with the WordPress install itself or with the installation of one of the Toolset plugins.
Let me know if you can find the fatal error in your logs, and whether recreating the site is a viable option (and whether it works).
Ahhhhh I thought you might say that...
Yes, for sure it would be easier to start again...
Will let you know how I get on.
Back soon.
Rita
Hi Nigel
I have quickly reinstalled and redesigned at least to a point where I can test and have ascertained that I can't seem to use the CONDITIONAL shortcode inside a views content template shortcode with views shortcodes inside the conditional shortcodes. Like this:
PAGE - BOOK THERAPY
[wpv-post-body view_template="page-grid"]
PAGE - BLOG FOR LIFE
[wpv-post-body view_template="page-grid"]
CONTENT TEMPLATE - PAGE GRID:
[wpv-conditional if="( '[wpv-post-title]' eq 'Book Therapy' )"]
<p>Some text...</p>
[wpv-view name="book-grid"]
[/wpv-conditional]
[wpv-conditional if="( '[wpv-post-title]' eq 'Blog For Life' )"]
<p>Some text...</p>
[wpv-view name="story-grid"]
[/wpv-conditional]
I like designing this way. Its speedy, efficient and ensures consistency... It's one of the reasons why I chose Toolset.
I can do this on other websites, even where the php version, wordpress version and all toolset plugins are absolutely the latest version... But for some reason NOT on this site...
The only way for me to 'get the job done' right now is to NOT use the PAGE GRID content template and instead paste each page's individual content directly into each page's content box.
I saw this article - which I tried on the latest versions - but no change... - https://toolset.com/errata/conditional-shortcodes-are-being-malformed-when-inserted-in-page-builders-with-the-new-shortcode-format/
Am at a loss what to check / test next 🙂
Rita
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rita
I set up something similar on a local test and had no problems, and you say you can use the same technique on your other sites.
So, I think all I can do is install your site locally and see if I have the same issue, and if so, I can then see if I can identify why.
Could you provide a copy of your site? hidden link
Hi Nigel
I followed the instructions. Had to disable the [open_basedir] setting on the server which I have reactivated after the package download.
Can you please provide a private message so that I can send you the link to download the package and your admin user credentials to access?
Standing by.
Rita
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rita
Let me set up a private reply, although URLs you post here are private by default, and I don't need the credentials because I can create my own in the final stage of installing the duplicate.
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rita
Either the issue is with your server, or I've misunderstood the issue, because after installing your site and looking at the Book Therapy page, for example, it appears to be working correctly (see screenshot).
I disabled the security and login plugins, but it is otherwise the same.
If you are not seeing the same and are instead seeing the actual shortcodes being printed un-parsed then there may be some PHP module disabled on your server.
Can you first show a screenshot of what you see on the same page so I'm clear what the issue is?
Ah apologies Nigel. I rebuilt the site without the shortcodes.
If you navigate to any page, delete the content and replace it with the shortcode for the content template 'page grid NOT IN USE', save and then view that published page you will see the problem. See screenshots attached.
Rita
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rita
I looked through your template (page grid NOT IN USE) and found one problem (screenshot) with the quotes in a conditional statement that needs fixing, but fixing it didn't resolve the problem.
I made a simple new template with just the following:
[wpv-conditional if="( '[wpv-post-title]' eq 'Book Therapy' )"] <p>Book Therapy title: [wpv-post-title]</p> <p>A View: [wpv-view name="book-feature"]</p> [/wpv-conditional]
I used that template on the Book Therapy page and it worked fine.
The template you use is long and complex (in terms of the number of conditions, some of which are nested), but if there were a problem with server resources I would expect to see a warning or error in the PHP logs, which I don't.
I suspect the problem may be that one or more of the Views or Forms that you insert with your template may itself have a problem with conditional statements that are affecting the template overall.
There is not much alternative to testing each section page-by-page to identify which is causing the issue.
Break this template up into individual templates for each page and when you isolate the page that doesn't work it should help narrow down what content in the template is the cause.
Hi Nigel
Thanks for your time to take a good look!
I have done as you say and separated each page with its own content template. And fixed the conditional shortcode inverted commas issue.
Therein the problem becomes clear! Any page/template where there is a [conditional] shortcode (such as 'if the user is logged in') any views or cred forms on that page are NOT displayed.
Rita
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
That doesn't sound right, because in the example I gave in my last reply I have a conditional shortcode with a View inside, and it displays correctly.
Am I missing some detail from what you found?
Hi Nigel
Ok I have done A LOT of testing and finally ascertained a direct incompatibility between my javascript and the conditional shortcode.
This is apparent on the 'Editor' page which I have isolated (All other pages are now displaying forms and views as normal). I have also double checked and tested all possible conflictions with other php versions, themes and their versions, other plugins, various conditional shortcodes etc.
Here is the correlation in summary which you can test with your duplicator copy of the site if you like Nigel:
The page called 'Editor' is unique because:
a) It is the only page where I have javascript in the html.
b) And it is the only page where there is a conditional shortcode specifically regarding the user, in this case, if the user is logged in or not.
1. The wordpress page editor calls the content template as usual: [wpv-post-body view_template="page-editor"]
2. Toolset Access plugin is deactivated.
3. In the site theme's footer I have the following script:
function showHide(elementid){ if (document.getElementById(elementid).style.display == 'none'){ document.getElementById(elementid).style.display = ''; } else { document.getElementById(elementid).style.display = 'none'; } }
4. The content template includes a user-related conditional shortcode and calls the script. Here is a simplified version:
[wpv-conditional if="('[wpv-current-user info='id']' eq '')" evaluate="false"] <h1>Editor</h1> <p>Here is some text and the two popups below.</p> <div class="folly-popcontainer"> <a href="javascript:showHide('pop-100');">New Story</a> <div id="pop-100" class="folly-popoverlay" style="display:none;"> <div class="folly-popcontent"> <a href="javascript:showHide('pop-100');" class="folly-popclose"></a> <h3>New Story</h3> [cred_form form="story-create"] </div> </div> </div> <div class="folly-popcontainer"> <a href="javascript:showHide('pop-101');">New Event</a> <div id="pop-101" class="folly-popoverlay" style="display:none;"> <div class="folly-popcontent"> <a href="javascript:showHide('pop-101');" class="folly-popclose"></a> <h3>New Event</h3> [cred_form form="event-create"] </div> </div> </div> [/wpv-conditional] [wpv-conditional if="('[wpv-current-user info='id']' eq '')" evaluate="true"] <h1>Editor</h1> <p>Sorry you are not logged in.</p> [/wpv-conditional]
5. Test results:
a. If I remove the javascript and keep the conditional shortcode - all forms and views are displayed.
b. If I keep JUST ONE javascript call and keep the conditional shortcode - all forms and views are displayed.
c. If I keep ANY MORE THAN ONE javascript call and keep the conditional shortcode - all forms and views are NOT displayed.
d. If I remove the conditional shortcode and keep ALL the javascript calls - all forms and views are displayed.
....Please note, I use this javascript with this html and these plugins on all my sites and have never had a problem until now. So the ONLY difference I can see between this website and every other website I have ever made is the php version...
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rita
As you have quite a particular setup here, I hope you don't mind if I ask you to do some testing.
I notice your showHide code sets the display property to an empty string when not hidden, which is not valid.
I'm guessing you don't set it to something like 'block' because the element may not have had a block display property previously.
Given that jQuery is available on front end pages with WordPress, why don't you use toggle()?
hidden link
Can I suggest a couple of things?
Change your showHide code so that it uses toggle, and see if that fixes the issue with the conditional shortcode.
If not, could you try simply replacing where you have
<a href="javascript:showHide('pop-100');" class="folly-popclose"></a>
with
<a href="javascript:console.log('Boo!');" class="folly-popclose"></a>
to see whether the issue is simply with including any javascript in this way at all.