WordPress.org

Ready to get started?Download WordPress

Forums

Can't get offset to work on archive page (1 post)

  1. nomi
    Member
    Posted 5 years ago #

    I'm having a hard time getting the offset to work on my archive.php page. Everything else works fine except for that. What I want to do is display a list of "more" posts in that category when you are on a category page in the sidebar.

    Here's my code:

    <?php
    			global $post;
    			$categories = get_the_category();
    			$category = $categories[0];
    			$cat_ID = $category->cat_ID;
    
    			$myposts = get_posts("numberposts=40&offset=20&category=$cat_ID");
    			?>
    			<ul>
    			<?php while (have_posts()) : the_post(); ?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    			<?php endwhile; ?>
    			</ul>

    It seems like it just totally ignores the offset and I can't figure out another way to do it.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic