WordPress.org

Ready to get started?Download WordPress

Forums

Quick hack : list all links (3 posts)

  1. Ozh
    Member
    Posted 10 years ago #

    I plan to add a lots of links and categories, but I only display two random links for each category to avoid loooooooooong lists. As I didnt find any build-in way to list all links on a separate page (did I miss something ?) I wrote these few lines :

    <?
    $categories = $wpdb->get_results("SELECT cat_id, cat_name FROM $tablelinkcategories");
    foreach ($categories as $category) {
    $links = $wpdb->get_results("SELECT link_url, link_name FROM $tablelinks WHERE (link_category=$category->cat_id AND link_visible='Y')");
    if ($links) {
    print "<h3>$category->cat_name</h3>

    ";
    }
    }
    ?>

    Result gives something like this : http://frenchfragfactory.net/ozh/index.php?a=links

  2. TechGnome
    Moderator
    Posted 10 years ago #

    Yes, you mayhave missed something. Here's how I list all my links:
    <?php get_links_list('name', TRUE); ?>
    On line does the trick.
    TG

  3. Ozh
    Member
    Posted 10 years ago #

    well, this doesnt override my Links option set to "display 2 random links" in each category :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.