Digital experiences for all disciplines
Forum Replies Created
-
-
Here is my first attempt at cleaning up, but unfortunately it doesn’t seem to work like o our genesis site.
function custom_post_thumb_image($thumb_img_url) { if ($thumb_img_url == "") { global $post; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); if (!empty($matches) && isset($matches[1][0])) { $thumb_img_url = $matches[1][0]; } } if(empty($thumb_img_url)) { if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $post->post_content, $match)) { $thumb_img_url= 'http://i3.ytimg.com/vi/'.$match[1].'/0.jpg'; } } return $thumb_img_url; } add_filter( 'sf_post_thumb_image_url', 'custom_post_thumb_image' );
possibly you might see the issue in the code. Needs fresh eyes I think.
Here is what I have added to the genesis build I did 2 months ago
function fallback_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches[1][0]; if(empty($first_img)) { if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $post->post_content, $match)) { $first_img= 'http://i3.ytimg.com/vi/'.$match[1].'/0.jpg'; } // $first_img = "http://placehold.it/350x150"; } return $first_img; }
Possibly needs some checking by you first.
No issue at all, will you add the code to the next version of update? if so I will provide it. I have done it for one of our other news sites with genesis framework. I will be happy to provide the code if you don’t mind checking over it for submission to the update?
I am sure others will benefit from this as it is typical for news sites that have videos to display as thumbs in the grid.
Hi Ed,
Please note, I never expect things, but yes, I was hoping it would have brought in the preview thumb image that is rendered automatically by vimeo and youtube with that code supplied.
Hi Ed,
oh we are so nearly there. I have updated the theme to latest build, added the snippet to child theme, and presto the images are showing. However the video auto thumbnails are not coming through. you can see this in the 4th post on my demo news site. http://cm.fullerdemo.com.au/campaigns/
Uploading the latest build now, and will add that snippet to the child functions.php
Will follow up shortly.Hi Ed,
I have downloaded and updated to the latest build as per the link you have provided. is there a new setting somewhere that I am to tick to make the first image show? The first images do show great on the RSS as I have just tested that, but cannot see them on the grid layout.
Perfect, and will close this off. Cheers Ed.
Thank you for taking the time to reply Melanie.OK, I will let the digital team know of this as they wouldn’t have thought of the load time (and to be honest I didn’t think of that either).
However I would be keen to see a setting to load a certain number, but allow for only so many to display. That could be a good work around. I recon this is similar to how Essential has tackled it by setting how many to initially load, but set the visibility of the loaded. Maybe correct me if i am wrong on that.
I will give you a real world scenario of our agency business http://fuller.com.au
We had installed GO portfolio for our stories to show in a grid, we have 9 categories of news / work. I had initially set the display of 16 posts, and then we had the issue where the end user might have selected work as the filter, then only 3 posts were showing, and gave the impression that we have only done 3 work projects (where in actual fact we have done 30). So this caused concern with the team here at Fuller, so I started to investigate and found Essential. It allowed me to set the number of loaded vs the number of displayed. it was a good compromise as the load more was set to 16 so any that were not loading didn’t really matter as the load more gave the impression to discover more.Hope that makes sense, if not I was just rambling on.
Hi Ed,
I have added this to the child theme functions.php, but does not pull up the images for some reason.
http://cm.fullerdemo.com.au/campaigns/I have just ticked the box to make you super admin on the Multisite. I am sure that would have helped if I had done that from the start.
So it will be deep linking? this could be a workaround. What if we could have a way to make the page only load 100 posts and have the filter work on those rather than 900. would there be a possibility for that as a compromise?
Hi Ed,
Yes you are right about it being for RSS. however I didn’t realise that it wouldn’t show the images in the grid layout. That will be great if you have a workaround function for the child theme. I will test out the feed tomorrow when back in the office for Campaign Monitor. Will keep you updated on that progress.
– Ciaran
-