WordPress.org

Ready to get started?Download WordPress

Forums

The Loop and number of results (3 posts)

  1. bowa
    Member
    Posted 7 years ago #

    with the loop i can query for the most recent posts for the first page it will return 10 results, on the next page again 10 results and so on

    while in the loop i want to know what position that post has in the resultset

    so the first post on the page 2 would need to return 10 or 11 (depending on it being 0 based or not)

    how can i find that ? is it a variable that is stored in the wp_query or so ?

    thanks in advance

  2. bowa
    Member
    Posted 7 years ago #

    no-one who can help me ?

    i thought this would be a really easy question, another approach, is there a way to know from the code if i am on the homepage or if i am on one of the paged-pages from the homepage content ? in other words if i am in / or /page/2/ but i would prefer doing it without having to look at the request uri, this information should be available somewhere? no ?

  3. Chris_K
    Member
    Posted 7 years ago #

    Well, I don't have the answer to your question... I think I'd suggest grabbing one of the "paged navigation" plugins (there's a handful of 'em out there) and examine the code to see how they do it.

    For instance, maybe check out WP-PageNavi?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags