Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have this query which I'm using in the sidebar, but when I place it in a php widget, the whole sidebar disappears... Any ideas?

global $wp_query;
$postid = $wp_query->post->ID;
if ( ! empty( get_post_meta($postid, 'TourURL', true) ) ) echo '<P>Show Link</P>';
else echo '<P>No Link</P>';
wp_reset_query();

Thanks

share|improve this question
It's difficult to say without the whole sidebar code (perhaps you could add it to a Pastebin?), but it could be that you are using wp_reset_query(), which maybe destroying the query you wish to display earlier than it should? – David Gard Mar 20 at 12:15
Hi David. Thanks Here's the pastebin... pastebin.com/FdPrsEJN Thx – emailsforben Mar 20 at 17:04
Anyone have any ideas? – emailsforben Mar 21 at 19:40

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.