retreive thumbnail from child pages and style current page thumbnail differently

Hi Experts,

On child pages, I would like to have thumbnails of all other child pages with the same parent.  I have the following code (and using Advanced Custom fields plugin):

<ul>

<?php query_posts(array('showposts' => 20, 'post_parent' => 7, 'post_type' => 'page')); while (have_posts()): the_post(); ?>

<li class"<if this is the current page give class current>">
<h2><?php the_field('field_name'); ?></h2>
</li>

<?php endwhile ?>

</ul>

I can get it to create a list, but not add a class to the current page item.  

I hope the above makes some sense!
mattleedcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
Something like this?

<?php
$poststoshow = 5;
if(is_single()) { $currentpost = get_the_ID(); }

$posts = get_posts('numberposts='.$poststoshow); ?>
<ul>
<?php
foreach ($posts as $post) { 

	setup_postdata($post);
	static $count1 = 0; 

	if ($count1 == "5") {
		break;
	}
	else { ?>
		<li<?php if($currentpost == $post->ID) { echo ' class="current"'; } ?>><?php the_title();?></li>
		<?php
		//the_content();
		$count1++;
	}
} ?>
</ul>
<?php
unset($posts);
$posts = get_posts('numberposts='.$poststoshow.'&offset='.$count1);
?>
<ul>
<?php
foreach ($posts as $post) {

	setup_postdata($post);
	static $count2 = 0;
	if ($count2 == "5") {
		break;
	}
	else { ?>
		<li<?php if($currentpost == $post->ID) { echo ' class="current"'; } ?>><?php the_title();?></li>
		<?php
		//the_content();
		$count2++;
	}
}
?>
</ul>

Open in new window


Source: http://wordpress.org/support/topic/how-to-highlight-current-post-title-in-multiply-lists
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jason C. LevineNo oneCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.