• samsm

    (@samsm)


    Hi, WordPress 1.5 newbie here. I’ve looked through documentation, but I didn’t find the info I desired.

    I can see how one can use WP_Query to get articles on a given day, month, that sort of thing, but I am not certain how to get an irregular time block, like the last 9 days, or the next 4 days.

    I looked at the source of a theme where the author achieved this by shooting a query through $wpdb->get_results($sql). However, the results from that were pretty much mysql rows which had to be altered to fit into the template.

    I would prefer a solution where one ends up with a $wp_query sort of object which would function just like one created through query_posts(‘whatever’) so that I can use the same sort of templating I use elsewhere on WordPress. Is the possible?

    Thanks for reading!
    Sam

Viewing 1 replies (of 1 total)
  • Thread Starter samsm

    (@samsm)

    Ok, I’ve done some more looking into this.

    It appears to me that one could accomplish what I want with a hack to WP_Query->get_posts(). You could basically build the request like you would any other, taking advantage of wordpress’s features. but swap in your own query instead of the wordpress constructed one.

    However, this seems a little brutal to me. Am I missing an easier method?

Viewing 1 replies (of 1 total)
  • The topic ‘Articles from a given time range’ is closed to new replies.