Support » Fixing WordPress » Retrieving custom fields from static page for sidebar

  • Hi,

    I have this code for pulling specific info from posts into my sidebar (outside the loop):

    	$IDOutsideLoop = $post->ID;
    	global $post;
    	$myposts = get_posts('showposts=3&category_name=releases');
    	foreach($myposts as $post) :
    	<?php if(get_post_meta($post->ID, 'thumb', true)): ?>
    	<a href="<?php the_permalink(); ?>"><img src="<?php get_custom_field('thumb', TRUE); ?>" width="155px" alt="<?php the_title(); ?>" /></a>
    	<hr />
    	<?php endif; ?>
    	<?php endforeach; ?>

    This particular section pulls the post’s associated thumbnail (via custom field) into the sidebar.

    What I really want to try and do is link to a NextGen gallery page in the same way. The NextGen widget doesn’t work with the theme for some reason, so I’d like to pull in the static page’s thumbnail using a custom field instead.

    Does anyone know how’s best to do this, if it’s possible at all?


  • The topic ‘Retrieving custom fields from static page for sidebar’ is closed to new replies.