WordPress.org

Forums

[resolved] Pagination query_posts tags (2 posts)

  1. onlypencil
    Member
    Posted 6 years ago #

    i want to display only posts from a certain category on main page. I was able to do it and then i had trouble where i couldnt go to the next page with navigation. I was able to solve that as well but now whenever i click on a tag in tag cloud i get the same posts from the original category query on main page. This is the code that i used to get it to work

    <?php if (have_posts()) : ?>
    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
    <?php query_posts('category_name=drawings&paged='.$paged);  ?>
    <?php  while (have_posts()) : the_post(); ?>

    when i go to the second page this is the parmalink
    http://domain.com/wordpress/page/2/

    i guess its using the index.php page to display all the posts even the ones from tags, so can i check that a tag is being looked up and not the main page posts

  2. onlypencil
    Member
    Posted 6 years ago #

    thank you but i got it to work i just had to use the is_home().

Topic Closed

This topic has been closed to new replies.

About this Topic