WordPress.org

Ready to get started?Download WordPress

Forums

opendir folder path issue (1 post)

  1. Shirley Studebaker
    Member
    Posted 1 year ago #

    I can't seem to get WP to recognize correct image folder path. Anybody see anything wrong with this??

    <?php
    
        global $post;
        $post_slug=$post->post_name;
    
    	$img_directory = bloginfo("template_directory");
    	$img_directory .= '/images/'.$post_slug;
    	echo $img_directory;
    	// Styling for images
    	echo '<div id="myslides">';
    	if ($handle = @opendir($img_directory) or die("There is an error with your image directory!")) {
    		while (false !== ($file = readdir($handle))) {
        		if (strpos($file, ".jpg")) {
    				$path = $img_directory . '/' . $file;
    				echo '<img src="' . $path . '"/>';
        		}
    		}
    		closedir($handle);
    	}
    	echo '</div>';
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Shirley Studebaker
  • This topic is not resolved
  • WordPress version: 3.5.1