Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 3rd Jan 2010, 03:37 PM   #1
New Warrior Member
War Room Member
 
Join Date: 2007
Location: Arizona USA
Posts: 24
Thanks: 86
Thanked 1 Time in 1 Post
Blog Entries: 1
Default
WP change slider to display Pages rather than Posts
Share on: 
fb share twitter share gplus share more share

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..

I love what I do and make money every day. It is as easy as 123. If you are interested in finally making money online, and you want to work with an amazing mastermind group that will be with you every step of the way showing you how let me know...

Advertising your business doesn't have to take you all day... http://myadposted.com simple amazing customer support and personalized service.
Sarah Harris is offline  
Unread 4th Jan 2010, 07:25 PM   #2
Technical Warrior
War Room Member
 
rufaswan's Avatar
 
Join Date: 2007
Location: Malaysia
Posts: 59
Thanks: 5
Thanked 17 Times in 14 Posts
Default
Re: WP change slider to display Pages rather than Posts
Share on: 
fb share twitter share gplus share more share

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

rufaswan is offline  
Closed Thread


Bookmarks

Tags
change, display, pages, posts, slider


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 05:35 PM.