[Resolved] PHP conditional statements not working after update to Toolset Types 3.4.14
This support ticket is created 3 years, 1 month ago. 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I recently realized that when I create new posts since updating to Types 3.4.14, the conditional statement do not working properly anymore.
I also tried:
<?php
$publications = get_post_meta(get_the_ID(),'wpcf-publications');
//Then you run and if statement on the field like this
if (!empty($publications)){
//do something
echo '<h2><span>Publications</span></h2>';
echo get_post_meta($postid, 'wpcf-publications', true);
}
?>
The problem is that the "publication" field does not have a value in the admin, but it is being displayed in the front end. The h2 should not display either. They should only display if the filed has a value.
I have a bit of an issue with the duplicator package. It seems to not have the website files as well as the database attached to it.
The only thing that is inside the duplicator zip file is the installer.php backup file. Can you create the duplicator package again. It should be atleast 200mb for a basic wordpress install.
The link I sent includes a separate zip file that has the webfiles. I had to do it manually because I got server errors while using duplicator. See the zip file named webfiles-backup.zip for the webfiles.
Can you double check that the post with ID "9038" doesn't actually have a value assigned in the field. Secondly what kind of field is this? Is it a select field or checkbox ?
Based on what the functions are returning the field itself does have a value. Does this also hold true for other fields with Empty values ? Also is "Pending" a valid option for this field.
When I enter the value "pending" in the field, it displays on the front end as "pending". When I delete the value from the field, It remove the text "pending" from the front end.
It is a text Multilined WYSIWYG field.
There are several fields that has this issue. See screenshts of backend and frontend.
The issue only happens when new posts are created or old posts are edited. Existing unedited post are fine, But if I edit or update an existing post, It will have the same issue im describing.
The H2 heading should not display if the fields are empty
The problem started happing after the most recent update to the plugins of Types and Views. But I don't think it's an issue with Views because I'm not using Views to display the content. I'm using the PHP code I sent you.
However i'm having some challenges restoring the backup given the way the files were provided. Are you able to create the backup using the All in One Migration plugin ?
If yes then can you create an account then create the backup using the plugin ?