-
AuthorPosts
-
January 31, 2014 at 3:51 pm #217465
Hi Dude,
First of all, Thx for the great support!
The other thread has been closed (https://kriesi.at/support/topic/need-help-on-masonry-portfolio-hover-figcaption/) so here is a new one. I have implemented the code you posted and its working great.. technically :)
I now have it displaying the woord: “array” or the when adding “, true” the id number of the custom field image appears. I have the feeling I am on the right track but havent been able to get to the end of the tunnel :) Just spent a few hours testing and reading documentation but still without success.
This is the code I have now displaying either array or the image id numer:
if(empty($this->loop[$key]['content'])) { $this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, ''); } $prev_img = get_post_meta($id, 'artist_logo', true ); if($prev_img) $this->loop[$key]['content'] = $prev_img;
Any idea what I need to change to output the actual image? Your help is greatly appreciated and I am sending a donation your way for sure!
Cheers,
Thomas BorkentFebruary 1, 2014 at 11:09 am #217755Hey borkent!
Sure – use this code
if(empty($this->loop[$key]['content'])) { $this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, ''); } $prev_img_id = get_post_meta($id, 'artist_logo', true ); if($prev_img_id) $image_attributes = wp_get_attachment_image_src($prev_img_id); // returns an array if(!empty($image_attributes[0])) $this->loop[$key]['content'] = '<img src="'.$image_attributes[0].'" />';
Regards,
PeterFebruary 1, 2014 at 12:48 pm #218240Wow cool, that worked perfectly, well almost :)
1) I am now getting the images returned as thumbnail size (80×80), is it possible to specify the size, like “full” or “large” with this code?
2) Also I noticed that when using this code, all items that dont have this image get the image from the previous item/id that did have it. Before, it was working well, it showed the word “Array” or the id number when the post had the custom image added, if it didnt it showed the title and excerpt.
thanks,
Thomas BorkentFebruary 2, 2014 at 1:30 am #218319Hi!
Please try this one:
if(empty($this->loop[$key]['content'])) { $this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, ''); } $prev_img_id = get_post_meta($id, 'artist_logo', true ); if($prev_img_id != '') { if($prev_img_id) $image_attributes = wp_get_attachment_image_src($prev_img_id, $size = 'full', $icon = false); // returns an array if(!empty($image_attributes[0])) $this->loop[$key]['content'] = '<img src="'.$image_attributes[0].'" />'; }
Best regards,
IsmaelFebruary 2, 2014 at 2:26 am #218334Hi Ismael,
Thx for this code, it is showing the images now perfectly and if there is no image the excerpt!
However this code somehow breaks the onmouseover part of the masonry, even when set to display on mouseover the overlay is showing at all times on all items. Strange huh? Any ideas?
Cheers,
ThomasFebruary 2, 2014 at 2:37 am #218335oh wait this doesnt sound like this code would do that, its probably brecause I am currently viewing it on a laptop with a touchscreen… as this is also what happens (and right so) on a smartphone or tablet which dont have a mouse :) sadly my laptop does…..
I think I might be able to solve this but will need to dig into the responsive masonry css that controls the mouseover on mobile devices. Any help in the right direction is appreciated!
thx for the support!
Cheers,
Thomas -
AuthorPosts
- The topic ‘Re: Dude – masonry-portfolio-hover-figcaption’ is closed to new replies.