WP change slider to display Pages rather than Posts

1 replies
I'm working with a magazine style theme (primus) that has a slider that displays posts from a specific category.. I would like to change that to display pages rather than posts..

here's the code :

<div id="slider">

<div id="mover">
<?php
$glidecat = get_option('zm_gldcat');
$glidecount = get_option('zm_gldct');
$my_query = new WP_Query('category_name= '. $glidecat .'&showposts= '. $glidecount . '');
while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
?>
<div class="slide">
<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<span class="slmet"> Posted by <?php the_author(); ?> On <?php the_time('F - j - Y'); ?> </span>
<p><?php the_excerpt(); ?></p>

<?php $gallery = get_post_meta($post->ID, 'gallery', $single = true); ?>
<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $gallery; ?>&amp;h=120&amp;w=250&amp;zc=1" alt=""/> </a>

</div>
<?php endwhile; ?>


</div>

</div>

I'm sure others would appreciate how to change this from pulling and displaying posts to displaying pages.. would be much more versatile..

Thanks in advance for your time..
#change #display #pages #posts #slider
  • Profile picture of the author rufaswan
    Replace this part

    <?php
    $glidecat = get_option('zm_gldcat');
    $glidecount = get_option('zm_gldct');
    $my_query = new WP_Query('category_name= '. $glidecat .'&showposts= '. $glidecount . '');
    while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
    ?>

    with this

    <?php
    $glidecount = get_option('zm_gldct');
    $my_query = new WP_Query('post_type=page&showposts= '. $glidecount . '');
    while ($my_query->have_posts()) : $my_query->the_post();$do_not_duplicate = $post->ID;
    ?>

    and there you go.

    - Rufas
    {{ DiscussionBoard.errors[1575843].message }}

Trending Topics