Skip Navigation

[Gelöst] Shortcodes not parsing (again)

This support ticket is created vor 5 Jahre, 10 Monate. 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)

This topic contains 8 Antworten, has 2 Stimmen.

Last updated by Luo Yang vor 5 Jahre, 10 Monate.

Assigned support staff: Luo Yang.

Author
Artikel
#508604

Hi, I had a problem a while ago, whereby on one content template, if there was a conditional shortcode wrapping a section of the content, none of the shortcodes would parse. Here is the old thread: https://toolset.com/forums/topic/shortcodes-not-parsing/

That was only on one host, and I ended up moving to another for unrelated reasons, and there was no longer a problem. Well that new host has now rebooted their server, changed all sorts of PHP configuration, and now I have the same problem again!

The conditional statement is important because it displays the content only if that post does not have the custom field "hidden". What I would like to know now is, if there is another way, maybe in functions.php, to designate a different content template if the post has the field, "hidden"?

Thank you

#508800

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hi,

It seems to be a server problem, we need to know if there is any PHP error occur in your website, please check these first:
1) deactivate other plugins and switch to wordpress default theme, and test again
2) Enable PHP debug mode, copy and paste the debug logs here
PHP Debugging
In case you think that Types or Views are doing something wrong (what we call a bug), you should enable PHP error logging. Again, edit your wp-config.php file and add the following:

ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
This will produce a file called ‘error_log.txt’ in your WordPress root directory. Make sure that the web server can create and write this file. If it cannot, use an FTP program to create the file and make it writable to Apache (normally, user www-data).
https://toolset.com/documentation/user-guides/debugging-types-and-views/

#508804

Hi, as in the previous instance on another server, the error is only actually a notice, but it is:
Notice: Undefined offset: 1 in /etc/etc/public_html/wp-content/plugins/wp-views/embedded/inc/wpv-shortcodes.php on line 4452

It is a live site and I can't unfortunately carry out the tests you suggest, but I have done all of that previously. This error only occurred after the server was upgraded from Cloud Linux to CentOS with EA4, which is most likely the same now as the other server where the error occurred previously. I could get the PHP info if it would help, but unfortunately I don't now have access to what it was before. Thank you

#508846

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I checked the PHP source codes of the latest version of Views plugin, file wp-views/embedded/inc/wpv-shortcodes.php on line 4452, there isn't related codes you mentioned above.

Are you using the latest version of Views plugin?
If not please try to upgrade it to the latest version, and test again.
You can download it here:
https://toolset.com/account/downloads/

And I suggest you backup your website before the upgrading.

#508849

Thank you, yes all of my plug-ins are up to date. Views is currently 2.3.1. I just downloaded the file in question and that particular line seems to be

$out .= $meta[$index];

Is that as it should be?

#508862

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

In the latest version of Views plugin 2.3.1, file wp-views/embedded/inc/wpv-shortcodes.php on line 4452, it is:

),

Which is different from what you mentioned above.

#508920

That's very odd, sorry I don't know how that happened but have now uploaded the plugin by FTP and the error is now on line 4799, which in fact is exactly the same code, but now further down.

#509174

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Since this problem only exists in your website, we need to check the compatibility problem and server problem, Please try this:
1) Duplicate same problem in another test website by follow our document:
https://toolset.com/faq/how-do-i-migrate-a-wordpress-site-from-one-domain-to-the-other/
2) deactivate other plugins and switch to wordpress default theme, and test again
3) If the problem still exists, provide the credentials of your test site in below "private detail box".

#510196

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Thanks for the details, I can login your website, please point out the problem page URL, where and how can I see the problem, which shortcode should be parsed?
I just test it in your website, for example, in the content template "Single - Property", line 4~6, add below three lines:

<hr />
wpcf-hidden: [wpv-post-field name = "wpcf-hidden"]
<hr />

You can remove it anytime you want.

and test the a "house" post in front-end, I can see above shortcodes has been parsed correctly.

For the new question "the undefined index notices", the [wpv-conditional] won't work within the shortcode [wpv-for-each], please check our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each
Note: wpv-conditional shortcode won’t work inside a wpv-for-each shortcode
So the codes you mentioned above will not works as expected