I created a loop for logged-in-users-only which works perfectly for all data except for meta keys. I'd like to be able to also extract meta keys but had no luck so far.
This is my loop (based on this post):
<?php add_shortcode( 'current-userposts' , 'show_userposts' );
function show_userposts(){
$user_id = get_current_user_id();
$loop = new WP_Query( array( 'post_type' => 'photo-spot', 'author' => $user_id ) );
if ( $loop->have_posts() ) {
?>
have_posts() ) : $loop->the_post(); ?>
" title="">
name );
}
?>
ID, '_cf_address', true); ?>
The function is called via a shortcode
When I use the exact same loop in a search.php template the custom value ('_cf_address') shows up perfectly but somehow not with the shortcode...
Any idea what might be going wrong?
PS> The preview screen doesn't show my html code - I hope it show up alright.