0

I have a taxonomy page called taxonomy-hotels.php I need to get all posts related to particular taxonomy-term. Assume I have a term 5 star hotel and it has 15 posts. But ony 10 returning/showing.

Pleasa let me know how to get all posts ? Here is my current code.

            <?php
                if(have_posts()) :
                    while(have_posts()) : the_post();   
            ?>
                <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
                    <div class="item">
                        <a href="<?php the_permalink(); ?>">
                            <h2><?php the_title(); ?></h2>
                            <?php the_post_thumbnail(); ?>
                        </a>
                    </div>
                </div>
            <?php
                    endwhile;
                endif;
            ?>

2 Answers 2

0

You're probably only set to show 10 posts per page, but your template doesn't have any pagination controls so you can go to the next page. There's a couple of different options (ie. Next/Previous links, or numbered pages). This article covers them: https://developer.wordpress.org/themes/functionality/pagination/

1
  • I am using wordpress loop and I haven't limit the no of posts to show. You mean to change the loop and pass the arguments right ? Except the code I posted here there is not any argument passing to this. Jul 21, 2017 at 12:07
0

If you display all post in one page then you can use 'posts_per_page' => -1 in your query OR If you want to display limited record in one page then you can use wordpress pagination

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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