emergingideas
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Navigate Categories with Prev NextHey 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
In reply to: How to use ‘get attached media’ with a custom fancybox?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
In reply to: How to use ‘get attached media’ with a custom fancybox?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
In reply to: How to use ‘get attached media’ with a custom fancybox?C’est magnifique! – this works a treat. Thanks so much for your help!
Forum: Developing with WordPress
In reply to: How to use ‘get attached media’ with a custom fancybox?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
In reply to: How to use ‘get attached media’ with a custom fancybox?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
In reply to: How to use ‘get attached media’ with a custom fancybox?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
In reply to: How do I get specific images from my post? (i.e. get image 1, 2, or 3)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
In reply to: How do I get specific images from my post? (i.e. get image 1, 2, or 3)Thanks @bcworkz I will try!
Forum: Hacks
In reply to: How do I get specific images from my post? (i.e. get image 1, 2, or 3)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
In reply to: How do I get specific images from my post? (i.e. get image 1, 2, or 3)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…