• Hay all.

    I have created a custom page template that will list all our blogs and a small excerpt from them along with a snap of the blog itself(theme screenshot).

    I am now working on a widget that will display the last 5 blog entries, but I want it to take the last 5 posts made globally to the site across all its blogs and if possible only one post per blog.

    in the end the widget should display 5 blogs and a small sample of their most recent posts, if the last 5 global posts made were on the same blog it should only show 1 and then move to the next unique blog.

    I recon I can handle most of this but its the sql to grab out just those last most recent and unique 1 blog 1 post type thing thats kicking me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter dvalin

    (@dvalin)

    this is the sql Im trying to sort out.

    SELECT
    wp_13_posts.post_date,
    wp_13_posts.post_title,
    wp_13_posts.post_content,
    wp_13_options.option_name
    FROM
    wp_13_posts,
    wp_13_options
    ORDER BY wp_13_posts.post_date
    DESC
    LIMIT 1;

    the idea is to select the date, title content and template from the posts and options tables and list only 1 row.

    but I keep getting a join error or something.

    Thread Starter dvalin

    (@dvalin)

    cracked it.

    SELECT wp_13_posts.post_date, wp_13_posts.post_title, wp_13_posts.post_content, wp_13_options.option_value
    FROM wp_13_posts, wp_13_options
    WHERE option_name = “template”
    ORDER BY post_date DESC
    LIMIT 1

    this will grab the info needed from one blog, as date,title,content,themepath which will be the most recent post from that given blog.

    Now I just need to loop through all blogs, and only display the top 5.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘find last 5 posts over all blogs ?’ is closed to new replies.