Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the following query for a custom post type:

<?php
             $posts = get_posts(array(
                'numberposts' => -1,
                'offset' => 20,
                'post_type' => 'faqs'

             ));


            if($posts)
            {

                foreach($posts as $post)
                {
                    echo '<li class="faq">
                        <p class="title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></p></li>';
                        /*<h4 class="title"><a href="' . get_permalink($post->ID) . '">' . get_the_title($post->ID) . '</a></h4><p>' . get_the_excerpt($post->ID) . '</p></li>'; */
                }

            }
             wp_reset_query();
            ?>

Is there a reason as to why the offset parameter doesn't work? Perhaps I need to write an entirely different query altogether?

share|improve this question

1 Answer

Set 'numberposts' value to a large positive number. With numberposts set to -1 it will return all the faqs ignoring the offset value.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.