Trying to create default featured image for blog post in Wordpress, but Code not working

I'm building a parent theme from Seamless at Themehybrid. I'm needing to add the functionality of a default image displaying in blog archives when the client doesn't add a featured image and use main post image instead.

I found this code and I'm trying to make it work with the existing code in my theme's template file. When I replace the thumbnail code with this new code I lose the page content. So I'm trying to merge the two and this is what I've come up with, but it's not working either:

In Functions.php:

function selva_main_image() {
$files = get_children('post_parent='.get_the_ID().'&post_type=attachment
  if($files) :
    $keys = array_reverse(array_keys($files));
    $num = $keys[$j];
    $image=wp_get_attachment_image($num, 'large', true);
    $imagepieces = explode('"', $image);
    $imagepath = $imagepieces[1];
    print "<img src='$main' alt='$the_title' class='frame' />";

Open in new window

In my template file:

<?php if ( ( current_theme_supports( 'get-the-image' ) && (has_post_thumbnail())) {
			 echo get_the_image()
			} else {
		   echo selva_main_image();

Open in new window

Alicia St RoseOwner & Principle Developer/DesignerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason C. LevineNo oneCommented:
current_theme_supports( 'get-the-image' 

Open in new window

Where is get-the-image coming from?

Shouldn't it be get_the_image?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You have a code error in your template file code also. If you lose your content when trying the code, that could be why.

Line 2 needs ; (semicolon) at the end:

echo get_the_image();

Open in new window

Alicia St RoseOwner & Principle Developer/DesignerAuthor Commented:
Adding the semi-colon didn't make much of a difference. Still getting the white screen of death. So I think the issue is bigger than that. jason1178 has provided a clue. I followed the trail and found that 'get-the-image' references a script in an extensions folder. The script has beaucoup options for images, one being the default image I'm looking for!

I set my default image in one of the options and Wow works like a charm. This script is so kickA$$ I'm attaching it below!
Alicia St RoseOwner & Principle Developer/DesignerAuthor Commented:
You set me on the right track!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.