• All new to this forum, so please forgive me if it is the wrong forum.

    I am trying to create a plugin/widget that shows 5 randoms bookmarks from the links database.

    this is what i got:

    function widget_content(){
      global $wpdb;
      $results = $wpdb->get_results("SELECT * FROM $wpdb->links WHERE link_visible ='Y'");
      $results = shuffle($results);
      $results = array($results);
      $results = array_slice($results, 0, 5);
    
      echo "<ul>";
    
        foreach ($results as $input) {
          $name = $input->link_name;
          $desc = $input->link_description;
          $url = $input->link_url;
            echo "<li>";
            echo "<a href=\"$url\">$name</a>";
            echo "</li>";
        }
    
      echo "</ul>";
    }

    Any idea what i am doing wrong?

    – Probeus

  • The topic ‘Problems with showing random and limited bookmarks’ is closed to new replies.