Did you try this? I am not sure if this is what you look for exactly.
$customs = get_posts('numberposts=-1&post_type=page&post_parent=1&meta_key=test_value');
foreach($customs as $custom) {
print get_post_meta($custom->ID, 'test_value', $single = true);
print '<br />';
}
Querying posts that are “pages” and child of ID 1 and returning pages only with custom field “test_value” then prints the value of custom key in a loop.
You can use something like this
<ul>
<?php
$IDOutsideLoop = $post->ID;
global $post;
$myposts = get_posts('showposts=5');
foreach($myposts as $post) :
?>
<li <?php if(is_single() && $IDOutsideLoop == $post->ID) print 'style="font-weight:bold";' ?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
Simply adds a statement that will print bold style if the ID outside loop matches the ID inside loop for single post.