SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A Tricky Wordpress Loop Customization

    I'm shooting to do something tricky with the Wordpress loop and I'm stumped as to how it may even be possible now.

    I have a small box on the home page of a new website, serving up 6 "recent posts" using the "recent posts" widget. The same information is found on the "blog" page which features the loop.php feed, limited to 6 posts.

    I'm using posts as products, beers to be exact. I want to give a beer tasting room the ability to update the most recent keg tapped by publishing a new post and pushing out the replaced keg. I overlooked the fact that each new post will simply push out the oldest post, instead of pushing out the specific keg that's been replaced.

    My question is, and it is a BOLD ONE, is there a way for one to designate which post in the current 6 post feed gets replaced by the most recent post? Is this possible using a really macgyver take on WP_query or query_posts, or is it something that would involve more PHP or intense customization?

    Any ideas or tips would be appreciated.

  2. #2
    SitePoint Member
    Join Date
    Dec 2003
    Location
    Manchester UK
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmmm.....for this I'd probably be tempted to do some sort of custom posts & custom variables.

    So say you have:-

    Beer 1 - Keg 1
    Beer 2 - Keg 2
    Beer 3 - Keg 3

    The "Keg" will be a required custom variable. Then should you do Beer 4 (based on Keg 1), you should be able to do some WP Query to display of the latest post of each keg.

    Does that make sense? Apologies I'm not getting technical, just getting my head around it myself!
    Hi! I'm Rhys Wynne and I wrote bbPress Complete
    Author+ Premium Wordpress Plugin - Use Code FORUM10 for 10% Off!
    WP Email Capture - Build Your List From Inside Wordpress
    Follow Me on Twitter

  3. #3
    SitePoint Member
    Join Date
    Jun 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    rhyswynne, sort of makes sense to me. I don't think I was entirely clear, or maybe it doesn't make as much sense as I thought it did.

    Where are you getting Beer 1, 2 and 3 from? I think I scrambled you a bit with my description of the effort, though I do think you're leading this in the correct direction. Let me clarify.

    Instead of publishing a brand new blog post that simply pushes out the oldest post to be published, how would it be possible to push out a post that's also determined from within the new post creation (within the Quickpress frame or the "Add new" post page), perhaps in a drop-down that offers the current 6 on tap, all before hitting "Submit?"

    or

    Instead of posting a brand new keg that simply pushes out the oldest keg to be tapped, how would it be possible to post a keg that's also determined from within the new keg creation (within the Quickpress frame or the "Add new" post page), perhaps in a drop-down that offers the current 6 kegs on tap, all before hitting "Submit?"

    Quote Originally Posted by rhyswynne View Post
    Hmmmm.....for this I'd probably be tempted to do some sort of custom posts & custom variables.

    So say you have:-

    Beer 1 - Keg 1
    Beer 2 - Keg 2
    Beer 3 - Keg 3

    The "Keg" will be a required custom variable. Then should you do Beer 4 (based on Keg 1), you should be able to do some WP Query to display of the latest post of each keg.

    Does that make sense? Apologies I'm not getting technical, just getting my head around it myself!

  4. #4
    SitePoint Member
    Join Date
    Jun 2012
    Location
    Iligan City, Philippines
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I suggest you create a custom post type for these reasons:
    1. You wouldn't worry about querying your custom post type
    2. You don't have to create a lot of custom coding in order to do what you want.
    3. It is simple to manage in the backend


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •