WordPress.org

Ready to get started?Download WordPress

Forums

get post titles on page (8 posts)

  1. mrpool
    Member
    Posted 6 years ago #

    I need some help with getting a list of post titles per page. I tried several different setups with paged= and $paged, but just can't get it right. I just want to get a list of the post titles from each page or a specified page.

    Any suggestions?

    Thanks!

  2. scribblerguy
    Member
    Posted 6 years ago #

    Depending on what you want to do, you could...

    (1) Use a custom Loop with a custom query_posts call before it.
    (2) Use wp_get_archives with the "type=postbypost" argument.

    Hope those help, but without a fuller explanation of your intentions (is this an archive page, a listing of pages from a category, etc.), I can only provide a general answer.

  3. mrpool
    Member
    Posted 6 years ago #

    I've messed with both, the query_posts would work if I could figure out how to just get the title of the posts. Basically, I'm looking to get a list of post titles for a specified page. Can do query_posts(paged=5) and make the "5" a var so it can be dynamic. So I could have displayed which posts are on which page. Does that makes sense? It does in my head, but I don't know if it does as I'm typing it...lol.

  4. scribblerguy
    Member
    Posted 6 years ago #

    I've messed with both, the query_posts would work if I could figure out how to just get the title of the posts.

    Then, you just need to use a loop with <?php the_title(); ?> inside of it and not the_content, the_date, all those other functions.

    Can do query_posts(paged=5) and make the "5" a var so it can be dynamic. So I could have displayed which posts are on which page. Does that makes sense?

    Unless you're doing something advanced with WP pages and Page Templates, WP will automatically get the correct posts based on the area of your website that a user is requesting. This includes "paged" queries.

    This is easier to see in action if you have pretty permalinks enabled. E.g., the second page of posts for a site's front page would have the structure "/paged/2/". If someone is browsing a category archive, the structure is "/category/cat-name/". There's nothing special that needs to be done as long as the proper template has a loop.

    Adding a query_posts can mess up the default query, so if you don't need to use that function, then leave it out.

  5. mrpool
    Member
    Posted 6 years ago #

    Well, here's the deal, I have a plugin called pagebar installed. It numbers out the post pages (Prev 1 2 3 4 ... Next), when you hover over one of the page numbers it pops up a tool tip with the page number. That's kinda repetitive and useless so I was trying to figure how to make it list the posts titles from that page in the tool tip.

    Yeah, I soon realized what happens with query_posts, lol.
    I think the 'the_title()' makes sense, I'll give that a shot and reply back.

    Thanks again!

  6. mrpool
    Member
    Posted 6 years ago #

    yeah....starting to think it's not possible. Going to need my hand held through this one. If anyone has any ideas it'd be much appreciated.

    Michael

  7. Lutz Schröer
    Member
    Posted 6 years ago #

    Nice idea to display the post titles. The question is, as you mentioned, if it is technically possible and what load this would put on the server.

    I'm gonna put this on my TODO list and will start thinking depper about it after I submitted my entry to the WordPress 2.5 Competition on 10th July.

    latz (author of pagebar)

  8. mrpool
    Member
    Posted 6 years ago #

    ah nice! thanks Latz! i'll keep an eye on your page then and I'll keep playing with it myself.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.