Hello all here's the snippet of code in which I have problems ...
& lt ;; Php $ ReleaseDate = Meta ('dvdReleaseDate'); ? & Gt;
If I return the value for a $ release date, I do not get anything ...
I have also tried. ...
& lt ;? Php $ releaseDate = get_post_meta (get_the_ID (), 'dvdReleaseDate', is true); ? & Gt; Nothing works. I really need help, I'm using Wordpress 3.0.1. Thank you
Try accessing this data at the most basic level:
& lt ;? Php echo 'DVD release date:'. Get_post_meta ($ post-> ID, 'dvdReleaseDate', is true) ;? & Gt; Make sure that you use this call anywhere where your $ post object is accessible - that is, within the loop. If you are using it outside of the loop (for example, in functions.php), then declare your $ posting object in advance like this:
& lt; ? Php global $ post; Echo 'DVD release date:'. Get_post_meta ($ post-> ID, 'dvdReleaseDate', is true); ? & Gt; If you still do not get any output from this, then it means:
- You are referring to your custom field by the wrong name
- This custom field has not been set for this post, or
- You are using this function anywhere, where your $ post object is unavailable
# 3 is in question, do something like this:
& lt ;? Php echo 'If there is data in the $ post, then it will be printed here:'; Print_r ($ post); Echo DVD release data: 'get_post_meta ($ post- & gt; id,' dvdReleaseDate ', is true); ? & Gt; If your post object is not printed, you are encountering # 3 if this happens, but there is no custom field output, it is one of the first 2.
Comments
Post a Comment