Community Forums › Forums › Archived Forums › Design Tips and Tricks › Define a default feature image when non available for Featured post widgets?
Tagged: Feature Post Widget, featured posts images, genesis
- This topic has 6 replies, 4 voices, and was last updated 12 years, 2 months ago by
Genesis Developer.
-
AuthorPosts
-
February 14, 2014 at 3:05 pm #90350
hobbygirl66
MemberI often make posst on the fly using my smartphone. I don't have time or means to create a feature image every time.
I do love the featured post/page type widgets on my home page and need an image for the widget to diplay properly on my home page. Is there a way to assign a default image to use in Featured post/page type widgets when there is not an image within the post/page on publication?
So I would have a generic "tips and tricks" type graphic or similar pop in when no feature image attached to post.Thanks!
LisaApril 14, 2014 at 9:21 am #100205Susan
ModeratorAs you posted this a while back, I hope you were able to get your issue resolved. If not, please check back in here, and I will escalate for you.
If it is resolved, please mark the thread “resolved”, and I will close it.
Thanks!
April 22, 2014 at 4:01 am #101821francky
MemberHi Susan!
I would also like to get the solution to this. I'm looking for the same stuff too.
Thank you in advance.
April 22, 2014 at 7:35 am #101847Genesis Developer
MemberTry this code
/** Define a default post thumbnail */ add_filter('genesis_get_image', 'default_image_fallback', 10, 2); function default_image_fallback($output, $args) { global $post; if( $output || $args['size'] == 'full' ) return $output; $thumbnail = CHILD_URL.'/images/thumb.jpg'; switch($args['format']) { case 'html' : return '<img src="'.$thumbnail.'" class="attachment-'. $args['size'] .'" alt="'. get_the_title($post->ID) .'" />'; break; case 'url' : return $thumbnail; break; default : return $output; break; } }
April 22, 2014 at 11:00 am #101888francky
MemberThank you @genwrock
Does that work for the Featured Post Widget only or for the whole site?
I got another solution here http://sridharkatakam.com/set-default-image-genesis-featured-posts-widget/ but would like to change the alt "Default Featured Images" to post title like you've done there. Can you help?
Shall appreciate it, Sir!
April 22, 2014 at 11:15 am #101892Genesis Developer
MemberMy code will work on whole site
April 22, 2014 at 11:15 am #101893 -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.