the website i’m referring to is technibility.com. If you look at it the slider on top is using this piece of code
<?php if(is_home()) { ?>
<div id="ca-container" class="ca-container">
<div class="ca-wrapper">
<?php while (have_posts()): the_post(); ?>
<div class="ca-item ca-item-2">
<div class="ca-item-main">
<?php if (has_post_thumbnail()): ?>
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?>
</a>
<?php endif; ?>
<h3><a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a></h3>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
<?php } ?>
problem is that if i used
query_posts('showposts=20');
its going to affect the entire site and show me 20 articles in the carousel and the posts on the page. How can i force it to only take affect with the slider?
also is there a way to have the_post_thumbnail() not stretch the image and use 150px height and any width but keeping it under 300px ?
You need to pass an array to WP_Query like this
then after you’ve ended the query use this to reset the query data.
example of standard query using WP_Query