WordPress.org

Support

Support » Plugins and Hacks » getting link category

getting link category

  • jcarlile

    @jcarlile

    I am a total php newbie, and I am trying to modify this script
    http://infovore.org/src/getrandomlinks.phps

    so that the function takes an additional parameter, which is the category id from which to choose links.

    I am able to add the new parameter, but I’m having a hard time getting at the category id of the chosen link

    I modified the line
    $results = $wpdb->get_results(“SELECT link_url, link_name, link_description FROM $wpdb->links WHERE link_visible = ‘Y’ ORDER BY rand() LIMIT “.$number);

    to read
    $results = $wpdb->get_results(“SELECT link_url, link_name, link_description FROM $wpdb->links WHERE link_visible = ‘Y’ AND link_category = $link_cat ORDER BY rand() LIMIT “.$number);

    but now the script fails, so I’m obviously doing something wrong with link_category. Any ideas what am I doing wrong?

    Thanks

  • The topic ‘getting link category’ is closed to new replies.
Skip to toolbar