1
votes

I'm a very basic web developer and starting this site

http://teammurdertrain.com/

I downloaded and installed a template and there is a slider. I have set my featured image in the post but nothing will be added to the returned code.

     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to 
     <?php the_title_attribute(); ?>"><img class="iphone" src="<?php
     bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo 
     get_post_meta($post->ID, 'featured', true);?>&amp;w=403&amp;h=273&a=t"  
     alt="Post Pic" /> </a>

It's trying to get the image from here. Currently the echo is giving back nothing

echo get_post_meta($post->ID, 'featured', true);

you will notice currently on the site that the image inside the iphone wrapper. It's because it's currently hard coded

3
"I downloaded and installed a template", Please read the documentation of the template, before implement it. - jogesh_pi

3 Answers

1
votes
echo get_post_meta($post->ID, 'featured', true); 

does not return the url of a featured image. It returns the value of a custom field with the id 'featured' which I am imagining has been set in the template to allow you to set posts with a featured flag and for them then to be displayed on the homepage.

To retrieve the url of your featured image look at answers like this;

How to get WordPress post featured image url

Incidentally, it is using timthumb to resize and crop the image so any issues there refer to this;

http://www.binarymoon.co.uk/2010/11/timthumb-hints-tips/

1
votes

your theme is conflicting with some javascript codes,
i thinks that's why the slider not working.

You have to find and remove these error, otherwise the javascript that applied by theme not working properly.

javascript Error

0
votes
<?php
 // Get feature image url and used it as per your requirement.
 // Make sure $post should be globle 
$feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo '$feat_image';
?>