samedi 2 avril 2016

PHP - How do I check if this WordPress Ninjaform shortcode is empty or not?

thanks for taking a look at my question.

What I need to do is pretty elementary, I'm using Ninja Forms to use as my form submission method. They have default post options which is great, so what this means is that I get any data via custom shortcodes, example:

If I want to get the name of a user it would be something like this:

[ninja_forms_field id=77]

What I'm trying to do is to add a conditional to a PHP code that will tell me if the shortcode is empty or not, something like this:

  if([ninja_forms_field id=77]){
      echo "works";
   } 
    else{
      echo "nope";
     }

Basic idea is to check if the shortcode is returning something, ive tried !empty() ... that doesn't work either.

Here's a quick guide on using Shortcodes in Ninja Forms

If you have any ideas on how to check shortcodes in WordPress please let me know, thanks!!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire