WordPress.org

Ready to get started?Download WordPress

Forums

Retrieving custom fields from static page for sidebar (1 post)

  1. heriz
    Member
    Posted 4 years ago #

    Hi,

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

    <?php
    	$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?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic