WordPress.org

Ready to get started?Download WordPress

Forums

Show Only Recently Updated Links (3 posts)

  1. andymatic
    Member
    Posted 9 years ago #

    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!

  2. andymatic
    Member
    Posted 9 years ago #

    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...?

  3. andymatic
    Member
    Posted 9 years ago #

    Would this be it?

    WHERE DATE_ADD(link_updated, INTERVAL ".get_settings('links_recently_updated_time')." MINUTE) >= NOW()

    Something like that?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.