WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Doing an Image Gallery with Fancybox( lightbox ) using a wordpress loop, take a look at the code inside the loop:

<div class="gallery_image">
    <p style="width:201px; height:199px;">
        <a rel="gallery_fancybox" href="<?php echo $image_attributes_large[0]; ?>" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>">
            <img style="width:187px; height:124px;" alt="" title="<?php echo get_post_meta( $attachment->ID, $key, true ); ?>" src="<?php echo $image_attributes[0]; ?>" />
            <span class="year"><?php the_time("Y"); ?></span>
            <span class="date"><?php the_time("j"); ?> de <span class="month"><?php the_time("F"); ?></span></span>
            <span class="access">Access</span>

There is in Another page an Image that the source is the Featured Image of this Gallery, and all of this is working without problems. However I want to do a fast change of that Featured Image, so, inside each image box loop add a button that just the admin will see ( with <?php global $user_ID; if( $user_ID ) : ?> <?php if( current_user_can('level_10') ) : ?> )that when it is clicked, the Featured Image of this Gallery change to the image that is inside that div.

Is it Possible?

Thanks a lot in Advance. Sorry for the bad English, and sorry for the weird Question.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.