I'd like to display content from a custom meta box that appears for a particular custom post type in the sidebar, when a single post of that type is being displayed. I know how to normally display that content in the post content area, but I'm assuming that using that same code in a widget won't work, since the sidebar is outside of the loop (right?). Any suggestions?

1 Answer 1


Well, you could access the $post variable with global $post and then access it's meta values with get_post_meta($post->ID) or something close to that. If you just want that to be accessed when you are viewing a single post, you can use

//do your stuff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.