Forums

Phantom theme not grabbing images in post (4 posts)

  1. Dougomite
    Member
    Posted 3 years ago #

    I'm using the Phantom theme(http://wordpress.org/extend/themes/phantom), but can't seem to get the theme to grab images inside my posts to use as a thumbnail of the post. As far as I could tell the my_functions.php of the theme searches the post for image or video attachments, links or information in the custom fields of the post. I've got all the above in a post but it still doesn't grab the image and instead uses the default image which is hardcoded into the function if no image is found.

    Anyone used this theme and had the same issue or can think of any reason why it doesn't seem to work for me?

  2. Dougomite
    Member
    Posted 3 years ago #

    Nevermind, ended up just using the display function for the them and setting everything up myself.

    If anyone else has the same problem here was my solution.

    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"> <?php echo display_the_image(array(get_post_custom_values("PostImage"),$post->post_title,"full"),$post, false, 'http://farm4.static.flickr.com/3127/2531119093_86f6e22283_m.jpg'); ?> </a>

    And here is the function I copied from the themes my_functions.php

    function display_the_image($cf_array = false, $en_post = false, $default_size = false, $default_img = false) {
    
    // Set nice names for image info
    	if($cf_array[0] == false && $default_img == true) :
    		$image[0] = $default_img;
    		$image_class = $default_size;
    	else :
    		$image = $cf_array[0];
    		$image_alt = $cf_array[1];
    		$image_class = $cf_array[2];
    	endif;
    
    // If there's any kind of image for this post
    	if(isset($image[0]) && strcmp($image[0],'') != 0) :
    	// Open img tag
    		$output = '<img src="'.$image[0].'"';
    		$output .= ' alt="';
    	// Image alt text
    		if(isset($image_alt[0]) && strcmp($image_alt[0],'') != 0) $output .= $image_alt[0];
    		else $output .= $en_post->post_title;
    	// Image class
    		$output .= '" class="';
    		if(isset($image_class[0])) $output .= $image_class;
    		else $output .= 'left';
    	// Close img tag
    		$output .= '" />';
    // If there's no image
    	else :
    		$output = false;
    	endif;
    // Return the image
    	return $output;
    }
  3. seescapes
    Member
    Posted 3 years ago #

    I don't understand how to do it?

  4. Justin Tadlock
    Member
    Posted 3 years ago #

    The problem is that the theme author took the code from the Get the Image plugin, but the theme author hasn't managed to update the code along with the plugin. Nor has he left the appropriate copyright notices back to the plugin (but that's another topic of discussion).

    You would do better by deleting all of the image functions from my_functions.php and updating your templates to use the plugin.

Topic Closed

This topic has been closed to new replies.

About this Topic