wordpress - Custom Fields/Meta Boxes - Only Display If Value is Present -


I am using WordPress add-ons to create custom fields for custom post types. I < p> Currently, I am using this code:

  & lt; php $ However, I have a value for a specific custom field, only then I need a way to display content. url = get_post_meta ($ post-> ID, 'snippet-context-url' is true); If ($ url) {resonant "<"; Lt; P & gt; & Lt; a href = '$ url' & gt; Reference URL & lt; / A & gt; & Lt; / P & gt; However, this field displays if the field exists (which is always in this situation). I need a code which is only a specific field.   

The check given on this example

 < code> & lt ;? php $ key_1_value = get_post_meta (get_the_id (), 'key_1', true); // Check if there is a value in custom field (! ($ key_1_value empty!) {echo $ key_1_value;} ? & gt;    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -