Title: emergingideas's Replies | WordPress.org

---

# emergingideas

  [  ](https://wordpress.org/support/users/emergingideas/)

 *   [Profile](https://wordpress.org/support/users/emergingideas/)
 *   [Topics Started](https://wordpress.org/support/users/emergingideas/topics/)
 *   [Replies Created](https://wordpress.org/support/users/emergingideas/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/emergingideas/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/emergingideas/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/emergingideas/engagements/)
 *   [Favorites](https://wordpress.org/support/users/emergingideas/favorites/)

 Search replies:

## Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)

 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [Navigate Categories with Prev Next](https://wordpress.org/support/topic/navigate-categories-with-prev-next/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/navigate-categories-with-prev-next/#post-9229043)
 * Hey thanks David, that looks like the thing…but I’m not having success with it,
   my Prev Next links don’t appear at all and I’m stumped. Maybe it’s a permalink
   set-up issue…but not finding a way to resolve. Have you had success with this
   before – and tips that might be useful? Thanks
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [How to use ‘get attached media’ with a custom fancybox?](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years ago](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/#post-9038888)
 * Ah! – ok, interesting. I am slowly learning…thank you for all the info. This 
   works superbly too. Thanks for your help!
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [How to use ‘get attached media’ with a custom fancybox?](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years ago](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/#post-9036931)
 * Hi bcworkz – this really works fantastically – thanks again!
 * …however, i’ve been unable to get the captions to display. Sorry if you can’t
   help me with this…I’ve been plugging away to do myself..but no luck and hit a
   wall, and wondered if you could help…
 * How would you do this…my approach doesn’t seem to work.
 * I added a little bit to the code we were working on to include:
    `$caption = 
   wp_get_attachment_url( $media_file->post_excerpt );`
 * and in the href included: `data-caption=\"$caption\"`
 * in full this is:
 *     ```
       <?php $media = get_attached_media( 'image', $post->ID );
       if(! empty($media)){
           foreach ( $media as $attachment ) {
               $full = wp_get_attachment_url( $attachment->ID );
               $medium = wp_get_attachment_image_url( $attachment->ID, 'medium');
               $caption = wp_get_attachment_url( $media_file->post_excerpt );
       echo "\n<a href=\"$full\" data-caption=\"$caption\" data-fancybox=\"images\">\n";
       echo '  <img class="image-2" src="'.$medium.'" alt="'.$media_file->post_title.'" />';
       echo "\n</a>";
           }
       }
       ?>
       ```
   
 * Thanks…i know my novice status is showing…trying to learn quickly, but not mastering
   it all so far.
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [How to use ‘get attached media’ with a custom fancybox?](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years ago](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/#post-9035550)
 * C’est magnifique! – this works a treat. Thanks so much for your help!
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [How to use ‘get attached media’ with a custom fancybox?](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years ago](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/#post-9034731)
 * Thanks so much for this!…slowly starting to make sense…I will get there one day!
 * Although, I tried it out…and I am still having the same problem – the image doesn’t
   appear in the lightbox overlay. I have made a error here maybe?
 *     ```
       <div class="img_div">
       <?php $media = get_attached_media( 'image', $post->ID );
       if(! empty($media)){
           foreach ( $media as $attachment ) {
               $medium = wp_get_attachment_image_url( $attachment->ID, 'medium');
       echo "\n<a href=\"$full\" data-fancybox=\"images\">\n";
       echo '  <img class="image-2" src="'.$medium.'" alt="'.$media_file->post_title.'" />';
       echo "\n</a>";
           }
       }
       ?>
       </div>
       ```
   
 * I was tinkering with another area – images from metabox uploads…to see if I could
   get that to work…well, hoping also to see if it’s the Fancybox file actually.
   I got the metabox area to work fine (or at least show the image on the lightbox),
   with the below code…tried to do something similar with the “get_attached_media”
   but no joy. (I also don’t want to use metabox image uploads if I can help it)
 * This is the metabox version:
 *     ```
       <?php
       	 $images = rwmb_meta( 'hp_img_1', 'size=medium' );
       	 $images = rwmb_meta( 'hp_img_1', 'type=medium' );
       	 if ( !empty( $images ) ) {
       			 foreach ( $images as $image ) {
       				 ?>
   
       				<?php 
       				 echo "<a href='{$image['url']}' data-fancybox='images' />";
       				?> 
       				<?php
       				 echo "<img src='{$image['url']}' class='featured-img' alt='{$image['alt']}' />";
       				 ?><?php
       			 }
       	 }
        ?>
       ```
   
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [How to use ‘get attached media’ with a custom fancybox?](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years ago](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/#post-9033982)
 * Ok – thanks for this…have changed the img tag alt attribute.
 * Yeah, I thought the same about needing the href for the fancybox to use.
    But,
   quite honestly, I just don’t know how to do this…i’m sure this is basic stuff,
   sorry for sounding dum…i’m slowly getting somewhere…
 * Could you point me in the write direction?…I haven’t found this through the WordPress
   documentation, or managed to pieced it together through further searches…
 *   Forum: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
   
   In reply to: [How to use ‘get attached media’ with a custom fancybox?](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years ago](https://wordpress.org/support/topic/how-to-use-get-attached-media-with-a-custom-fancybox/#post-9033100)
 * Thanks bcworkz! – ok, would it then be something like this?
 *     ```
       <div class="img_div">
   
       <?php $media = get_attached_media( 'image', $post->ID );
       if(! empty($media)){
           foreach ( $media as $attachment ) {
               $full = wp_get_attachment_url( $attachment->ID );
               echo '<img class="image-2" data-fancybox="images" src="'.$full.'" alt="'.$media_file->post_title.'" />';
           }
       }
       ?>
       </div>
       ```
   
 * But I tried this but have the same problem…the overlay opens but doesn’t load
   the image. What I see is the black overlay, the number of images and the ability
   to scroll through, but all that has loaded is a white band where the image should
   be, which, according to the output code seems to be an empty Iframe?
 * I’m totally at a loss…
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [How do I get specific images from my post? (i.e. get image 1, 2, or 3)](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/#post-8327524)
 * Thanks for your help here guys…but I am still struggling..
 * Could you help me get on the right path, or lay it out for me very simply (forgive
   me for being a numpty)
 * I have placed this in like this:
 *     ```
       <div class="w-slide">
   
       <?php $images = get_attached_media( 'image' );
       foreach ($images as $i) {
           print_r( $i);
       } ?>
   
       <img src="<?php echo $img['url']; ?>" alt="<?php echo $img['alt']; ?>">
   
       </div>
       ```
   
 * I’m sure I am missing some v.important bits…my images are not displaying at all
   (
   and I re-uploaded them to the post after using the get_attached_media…thanks 
   for your tip on this)
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [How do I get specific images from my post? (i.e. get image 1, 2, or 3)](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/#post-8325105)
 * Thanks [@bcworkz](https://wordpress.org/support/users/bcworkz/) I will try!
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [How do I get specific images from my post? (i.e. get image 1, 2, or 3)](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/#post-8324956)
 * thanks…this makes sense…but i’m still not getting any joy. Slow learning curve.
 * what would the echo look like? and how it is integrated? Something like this?
 * img src = echo $image->url()
 * and can I put the whole shibang in a div do you think?
 *   Forum: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
   
   In reply to: [How do I get specific images from my post? (i.e. get image 1, 2, or 3)](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/)
 *  Thread Starter [emergingideas](https://wordpress.org/support/users/emergingideas/)
 * (@emergingideas)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/how-do-i-get-specific-images-from-my-post-i-e-get-image-1-2-or-3/#post-8324715)
 * Thanks Steve…i’m learning slowly!
 * Could you help me a little more? – how can I use this function for getting specific
   images from my post – like ‘image 1’ for example…

Viewing 11 replies - 1 through 11 (of 11 total)