butterscotch butterscotch - 1 year ago 106
PHP Question

"Call to undefined function post_image_thumbnail()" Error

I recently changed my WordPress theme. I have a custom page template that I am trying to move over to the new theme, but the custom page template is now throwing an error.


Fatal error: Call to undefined function
post_image_thumbnail()
in [link to custom page url] on line 55


I thought it might be the child theme not supporting thumbnails, so I added this to the child theme's
functions.php
:

add_theme_support( 'post-thumbnails' );


But it didn't solve anything.

Could someone help debug my code? Maybe I have a syntax error that I can't see?

<h3><?php echo get_cat_name(26);?></h3>
<?php query_posts(array('category__and'=>array(75,26),'meta_key'=>'wpcf-sortname','orderby'=>'meta_value','order'=>ASC,'posts_per_page' => -1));if ( have_posts() ) while ( have_posts() ) : the_post(); ?><div class="indentlist"><?php post_image_thumbnail(); ?><div style="clear:both;"></div><a href="<?php the_permalink() ?>" class="participants"><?php the_title(); ?></a></div><?php endwhile; // end of the loop. ?>


Thank you!

Answer Source

Your old theme contained a function that your new theme doesn't. The content you've moved from the old theme to the new one calls the missing function resulting in an error.

Your best course of action would be to move the missing function to your new theme. It may prove more difficult than a simple copy/paste.

An alternative would be to replace post_image_thumbnail(); in the code you posted with the_post_thumbnail( 'SIZE' );. Change 'SIZE' to a valid image size name. Options you could try include 'large' and 'full'.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download