Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter throbthrobnet

    (@throbthrobnet)

    i figured it out and recoded the entire thing:

    function get_slideshow_images() {
    	global $wpdb;
    
    	$_query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts AS posts
    		WHERE posts.post_type = 'attachment'
    		AND posts.post_content = 'slideshow'
    		AND posts.post_mime_type IN ('image/jpeg','image/gif','image/jpg','image/png')
    		ORDER BY ID ASC
    		");
    
    	$_result = $wpdb->get_results($_query);
    
    	if (count($_result > 0)) {
    		print "<div id=\"featured_container\">\n";
    		foreach ($_result as $_post) {
    			print "\t\t<img src=\"".wp_get_attachment_url($_post->ID)."\">\n";
    		}
    		print "\t\t</div>\n";
    	}
    
    }
    ?>

    Thread Starter throbthrobnet

    (@throbthrobnet)

    let me try to format the code a bit better here…

    function getImagesForSlideshow($_max = 5, $order = 'latest')
    {
    
        if ($order == 'random') {
            $r = new WP_Query("showposts=$_max&what_to_show=posts&post_status=inherit&post_type=attachment&orderby=rand&post_mime_type=image/jpeg,image/gif,image/jpg,image/png&post_content=slideshow");
        } else {
            $r = new WP_Query("showposts=$_max&what_to_show=posts&post_status=inherit&post_type=attachment&orderby=menu_order ASC, ID ASC&post_mime_type=image/jpeg,image/gif,image/jpg,image/png&post_content=slideshow");
        }
    
        if ($r->have_posts()) {
    
            echo "<div id=\"featured_container\">\n";
            while ($r->have_posts()) : $r->the_post();
    
    		#echo apply_filters('the_content', $np->post_content);
    //		$gimme = the_title();
    		//print "\t\t<img src=\"".wp_get_attachment_url(get_the_ID())."\" title=\"".$gimme."\"/>\n";
    
    			print "\t\t<img src=\"".wp_get_attachment_url(get_the_ID())."\"/>\n";
    
    		#print "<!-- " . get_the_content() ."-->\n";
            endwhile;
    		echo "\t\t</div>\n";
        }
    
        return $_retval;
    }

Viewing 2 replies - 1 through 2 (of 2 total)