get_post_meta(post->ID, ‘custom_field_value’, true);
When you add the fancy dollar sign in front of “post->ID” like so “$post->ID”, the problem is fixed. Chalk it up to a late night bonehead move on my part, I guess. 🙂
I ran into a problem this morning.
I was trying to use get_post_meta() within the loop and was unable to return the custom field value. The solution was to use “get_the_id()” rather than “post->ID” as shown below.
$my_query = new WP_Query('showposts=1');
while ($my_query->have_posts()) : $my_query->the_post();
get_post_meta(get_the_id(), 'custom_field_value', true); // This works!
get_post_meta(post->ID, 'custom_field_value', true); // This DOES NOT work!
endwhile;
Thanks to this post for providing the solution.
More posts from themightymo.com
Mark Gason Papervision 3D Presentation at FlashMN
I am liveblogging from Mark Gason’s presentation at FlashMN. These are my notes. Check out Mark’s page of resources. It contains links to tutorials as well as all sorts of other Papervision 3D-related stuff. http://gasolicious.com/flashstuff/PV3D_presentation.html Swift 3D is better than Papervision 3D in some ways: – You can model in Swift 3D, but AutoCAD also…
Reorganize Your WordPress 2.7 Admin Panel with Fluency 2.0
Yesterday I discovered the new Fluency 2.0 plugin for WordPress 2.7. It does a fantastic job of cleaning up the admin interface and makes the back-end WordPress experience much better for users.
We Now Offer Search Engine Optimization!
We have just teamed up with one of the web’s finest search engine optimization gurus, Greg Cryns, and will now be offering his services to you, our customers! For you, our customer, this means that we now have added expertise in driving targeted traffic to your website. Greg has over a decade worth of search…