• I’m wanting to create a function that shows only recently updated links in a links list. I’m rooting through the code and it looks like the code that decides this would be in links.php in the get_links function. I’m wondering how I should modify the SQL query to grab only links with a recently updated list within the prescribed interval.

    Here’s the SQL query code from get_links

    $sql = “SELECT link_url, link_name, link_image, link_target,
    link_description, link_rating, link_rel $length $recently_updated_test $get_updated
    FROM $wpdb->links
    WHERE link_visible = ‘Y’ ” .
    $category_query;
    $sql .= ‘ ORDER BY ‘ . $orderby;
    $sql .= $direction;
    /* The next 2 lines implement LIMIT TO processing */
    if ($limit != -1)
    $sql .= ” LIMIT $limit”;

    What would I add to the WHERE spec that would limit things to the interval up updated-ness?

    If that is too involved – how could I root out the non-recently updated links once the list is made? To somehow run a command on $results to remove all links in the array that don’t have recently_updated set to true?

    Thanks!

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

    (@andymatic)

    Doing some more looking around the code looks like I’d add another filter to the

    WHERE link_visible = ‘Y’

    statement. Something that says link_updated has to be sooner than links_recently_updated_time… I think…?

    Thread Starter andymatic

    (@andymatic)

    Would this be it?

    WHERE DATE_ADD(link_updated, INTERVAL “.get_settings(‘links_recently_updated_time’).” MINUTE) >= NOW()

    Something like that?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show Only Recently Updated Links’ is closed to new replies.