WordPress.org

Ready to get started?Download WordPress

Forums

can anyone help me with loop?! (3 posts)

  1. emaarkhan
    Member
    Posted 1 year ago #

    Hi,
    I am working on a page, where i want to display excerpt from a category or post id, with their pictures attached in the main post. i have post couple of times in this forums but no one has answer. can someone help me with this sort of loop??
    thanks

  2. Santosh
    Member
    Posted 1 year ago #

    here is code

    query_posts(array('category_name' => 'news','posts_per_page' => '4','post__not_in'=>get_option('sticky_posts')));
    			?>
    			<?php while (have_posts()) : the_post(); ?>
    
    		<div class="post" id="post-<?php the_ID(); ?>">
    			<h3 class="bg">
    				<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
    			</h3>
    				<p><?php the_post_thumbnail(array(250,250), array ('class' => 'alignleft')); ?></p>
    				<p><?php the_excerpt(); ?>	</p>
    		</div>
    
    		<?php endwhile; ?>
  3. Santosh
    Member
    Posted 1 year ago #

    above code will show those post which are not sticky you change parameters of query_posts function

Topic Closed

This topic has been closed to new replies.

About this Topic