WordPress.org

Ready to get started?Download WordPress

Forums

[HELP] Tweaking the RSS feed: images won't show. (1 post)

  1. mattjakob
    Member
    Posted 5 years ago #

    Hello Im trying to edit the RSS feed engine so that for each post there's an image associated with it.
    Every post has one or more image(s), and in the index.php's The Loop I managed to display one for each post with the code at the bottom of this post.
    I tried a similar method in wp-includes/feed-rss2.php and other severl files but not only it's not working... apparently whatever I change in them is not changing in the RSS feed !!! So basically I guess I'm editing the wrong files as well.

    Could someone please tell WHIC FILES are actually used by WordPress 2.7 to output a standard RSS feed and how to implement a working image tag for each post inside the RSS feed?

    Many thanks :)

    HERE'S THE CODE I USE IN THE LOOP TO DISPLAY THE FIRST IMAGE CONTAINED IN EACH POST:

    <?php
    			$my_post_type = rand(1,3);
    			//$my_post_type = 1;
    			$upload_path = get_option( 'upload_path' );
    			$upload_path = trim($upload_path);
    
    			$img_full_url = the_attached_image();
    
    			if ($img_full_url != "") {	
    
    			$temp = substr(strrchr($upload_path, "/"), 1);
    
    			list($url, $filename) = explode($temp, $img_full_url);
    
    			$img_url = $upload_path . "/" . $filename;
    
    			//$imagesize = getimagesize($img_url);
    			//list($width, $height, $type, $attr) = getimagesize($img_url);
    
    			$new_width = "180";
    			//$new_height = ($height*$new_width)/$width;
    			//$theClass = "post" . $my_post_type;
    			$theClass = "";}
    
    			if ( $img_full_url != "" ) {
    			echo '
    			<!-- IMAGE -->
    			<div class="post_img'.$my_post_type.'">';
    				//echo '<img src="' . $img_full_url . '" width="' . $new_width . '" height="' . $new_height . '" alt="post image"/>'; }
    				echo '<img src="' . $img_full_url . '" width="' . $new_width . '" alt="post image"/>'; }
    			 	else {
    				echo '<div>'; } ?>
    			</div>

Topic Closed

This topic has been closed to new replies.

About this Topic