WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Is There A Limit Query Functions & Loop Calls? (10 posts)

  1. KatGirl
    Member
    Posted 7 years ago #

    I'm curious...

    Is there a limit one should consider when using query functions, in my particular case I used query posts with individual loop calls, to display information on a Category Page? And, if using more than say... five (query&loop) will it be detrimental to my page load time? Or server?

    I ask this because I've hack an Archive Template that pulls specific posts from specific categories and displays them by Month & Year. To get this to work, I had to insert multiple loop calls, hence my question.

    Your thoughts?

  2. Joshua Sigar
    Member
    Posted 7 years ago #

    If you're happy with the load time, then your visitors should be, too. Server? Don't worry about it until your host complains.

    Nonetheless, if you post your code at http://pastebin.com , we may give better answer.

  3. KatGirl
    Member
    Posted 7 years ago #

    Thanks heaps alphaoide. I'll drop the template now for you - or anyone else who might want to check it over and give me better pointers.

    At the moment, because WordPress doesn't offer archives by specific category in a monthly format, I've had to hack an archive template to produce the results I need without it interfering with the standard global "archives" page

    My logical brain is happy with the output, but I'm no PHP guru by any stretch of the imagination. I'll drop the pastebin URL back here when done :)

  4. KatGirl
    Member
    Posted 7 years ago #

    PasteBin URL : http://wordpress.pastebin.com/788370

    Any help to improve this would be enormously appreciated. Or even better *grin* if some clever php plugin creator could convert it into a plugin, minus the cruft would be fab!

  5. Joshua Sigar
    Member
    Posted 7 years ago #

    Not too bad at all, this is nothing. Can't figure it out a better way.

  6. KatGirl
    Member
    Posted 7 years ago #

    Thanks alphaoide for your input. Naturally as the months roll by I'll be duplicating the code and changing monthly and eventually yearly (almost chrissy now!) output.

    But until there's a better way of doing this, much appreciated.

  7. Joshua Sigar
    Member
    Posted 7 years ago #

    Oh, I thought the three loops are fixed. So, what is it, in general, you want to display? We could probably come up with better way so that you don't have the touch the code again after.

  8. KatGirl
    Member
    Posted 7 years ago #

    Hi alphaoide, sorry for the delay.

    After extensive examination of archives, I thought the best way of producing date based posts from specific cats and subcats and then display those posts in a grouped archive-e way on the Parent Cat Page ie:

    Your now looking at Current Category Page:
    [div entry]
    Current Cat (Parent Cat) text
    post title link
    post title link
    [/div]

    [div entry]
    July 02 Cat (child) link
    post title link
    post title link
    [/div]

    [div entry]
    August 06 Cat (child) link
    post title link
    post title link
    [/div]

    was to create that template (above). My needs are, well, specific, because I need the posts to display exactly the way I've grouped them.

    Only drawback is, naturally, I'll have to create more cats to accommodate new posts for new months.

    Your thoughts?

  9. Joshua Sigar
    Member
    Posted 7 years ago #

    I don't get it. I don't know what you want. I don't see a pattern.

    So, next month, how does the page look like?

  10. KatGirl
    Member
    Posted 7 years ago #

    Longer :)

    I guess I over-exaggerated. I'm not showing posts, just skinny titles 12px height. That's it.

    Now that I think about it... I could just use wp_linksbyname to draw the grouping together and eliminate the looping madness. And, I wouldn't have to use monthly categories either - just hard-code the link on a Category Post or some such nonsense and use Pages for the reivews.

    See? Your input did help. I saw how ridiculous my set up was.

    Thanks for the feedback.

Topic Closed

This topic has been closed to new replies.

About this Topic