Forums

The Loop and Categories (1 post)

  1. svaldesm
    Member
    Posted 1 year ago #

    Hello,

    I'm building a site, http://www.caae.cl/wordpress but having some troubles.

    This is the thing:
    - For the index, I want that the first two posts that appear as featured, show the last posts of a special category. Then, after that, that shows the last 10 posts of the whole website.
    - For every special category, that it would show the last 2 posts of that category as featured, and the last 10 posts as "non" featured.

    I have been able to achieve that so far in the index, BUT, the problem is when I click on the "older posts" button, because it won't show the last posts of that category, or in the case of the index, of the whole site.

    This is the code that I'm using for the index, to show the last 2 posts of the site:

    global $post;
    					$args = array( 'numberposts' => 1, 'offset'=> 1 );
    					$myposts = get_posts( $args );
    					foreach( $myposts as $post ) :	setup_postdata($post); ?>
    					<?php endforeach; ?>

    And for the other posts:

    <?php query_posts( array( 'posts_per_page' => 5, 'offset' => 2 ) ); ?>
    					<?php while ( have_posts() ) : the_post(); ?>
    						<?php endwhile; ?>

    I would be very grateful if anyone could help. Thanks a lot.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags