Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter kamrankhan

    (@kamrankhan)

    Damn, that makes sense.

    However, why does the previous code not work? Shouldn’t the query go through all the posts and organize and then display only the ones with featured images?

    Thread Starter kamrankhan

    (@kamrankhan)

    this worked:

    $postslist = get_posts( array( 'numberposts' => 10, 'order'=> 'DESC', 'orderby' => 'title', 'post_type' => 'any' ) );
    foreach ($postslist as $post) :  setup_postdata($post); ?>
    						<?php if ( has_post_thumbnail()) : ?>
       							<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
       							<?php the_post_thumbnail( array( 1000, 315), array( 'class' => 'slideshow-img' ) ) ?>
       							</a></li>
    						<?php endif; ?>
    					<?php endforeach; ?>

    but it only displayed the first three posts. Changing numberposts to 1000 displays all of them (there are only 10 posts with featured images assigned’. What the fudge is wrong with my code?

    Thread Starter kamrankhan

    (@kamrankhan)

    So this works:

    <?php $my_query = new WP_Query( array ( 'order' => 'DESC' ) ); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    	<?php setup_postdata($post); ?>
    	<?php if ( has_post_thumbnail()) : ?>
       		<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >
       		<?php the_post_thumbnail( array( 1000, 315), array( 'class' => 'slideshow-img' ) ) ?></a></li>
    		<?php endif; ?>
    <?php endwhile; ?>

    Except, it won’t show any pages with featured images. UGGHHH.. This should be dementedly easy; what am I doing wrong?

    You access phpmyadmin through your hosting/server account, not through wordpress.

    Thread Starter kamrankhan

    (@kamrankhan)

    correction

    Sorry about this but I just realsied that the code works, but it only shows the first featured post. It doesn’t move forward with other posts that have featured images associated with it.

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