WordPress.org

Ready to get started?Download WordPress

Forums

Asides and Post Count (6 posts)

  1. Chris_K
    Member
    Posted 8 years ago #

    I've recently implemented Asides in my blog's theme using the sidebar variant as explained in this codex page: http://codex.wordpress.org/Adding_Asides

    Works great.

    I'd like to fancy it up a bit though. I'm configured to show 7 articles on the main page. If there are 3 asides in that time frame, then I show 4 articles and the 3 asides. Gets a bit awkward looking if I have 7 asides...

    What I'd really like to do is figure out how to show my 7 articles in the main loop (which excludes my asides category) and show a fixed number of asides in the sidebar.

    Yes I've searched. Perhaps I missed something obvious, but the solutions I found didn't seem to quite get me to where I wanted to be.

  2. Chris_K
    Member
    Posted 8 years ago #

    Actually, let me amend my goal a bit to simplify:

    What I'd really like to do is figure out how to show my 7 articles in the main loop (which excludes my asides category).

  3. Cypher
    Member
    Posted 8 years ago #

    I think you're looking for the "query_post" function..

    http://codex.wordpress.org/Template_Tags/query_posts

    What you should do is call

    query_post("cat=-<asides cat>");

    This way, your home page will show all the posts not in the asides cat, you can leave your asides code as it is and in your Options, just set the home page to show 7 posts.

    Regards

  4. Chris_K
    Member
    Posted 8 years ago #

    Thanks for the reply.

    That approach managed to get my 7 on the page, true, but it also ensured that I'd get nothing in the asides sidebar bit.

    It would appear that the example (link in my original post) uses rewind on the same loop for both the main post list and the aside list.

    I've experimented a bit with using multiple loops. One loop excluding the aside cat and the other loop only including that category. However, for some reason, doing that ensures that my next_page / prev_page navigation goes all to heck. They all result in the same as the main page.

  5. deko
    Member
    Posted 8 years ago #

    I've looked at the codex page for asides but would like to see a demo - what is your site, HandySolo?

    Also, I've looked for next_page and previous_page on http://codex.wordpress.org/Template_Tags but did not see them - did you mean next_post and previous_post?

    I am trying to implement page navigation, which may be similar to this issue.

    I want to enable paging through 'x' number of posts while displaying 'y' at a time.

    To do this, I think I need to use some kind of session/state variable so I can display a nav link like next 5 posts and previous 5 posts.

    The goal is to have these links display (in the main page)
    5 posts at a time in sequential order without losing track of which posts are currently displayed, thus allowing forward and backward browsing 5 posts at a time.

    Any idea how to do this?

  6. Chris_K
    Member
    Posted 8 years ago #

    Deko - just click my name to the left for a link to my site.

    Next_page / previous_page have apparently been deprecated, but still work. There are better options now though (think I replied to your other thread yesterday with them). For instance, the Default theme uses:
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?>
    </div>

    Page navigation is built in using the tags mentioned. I have no clue how to do the counting part of your question though.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags