Ready to get started?Download WordPress


[resolved] List links by category name not ID (3 posts)

  1. josalmon
    Posted 8 years ago #

    Hi everyone,

    I've justed started using the Tiga theme but I can't figure out how to list my links by category name and not ID.

    The current code looks like this:

    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
    foreach ($link_cats as $link_cat) {
    if (get_links($link_cat->cat_id, '', '', '', FALSE, '', FALSE, FALSE, -1, FALSE, FALSE)) {
    <div class="left-widget-title"
    id="linkcat-<?php echo $link_cat->cat_id; ?>">
    <?php echo $link_cat->cat_name; ?>
    <div class="left-widget">
    <?php wp_get_links($link_cat->cat_id); ?>

    Any ideas about what I should change it to? I did look at the codex but I didn't understand it!!


    Thanks, Jo

  2. Kafkaesqui

    Posted 8 years ago #

    Codex would have little to say about the code above since it's custom to the theme. Try changing the $link_cats line at top to:

    $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories ORDER BY cat_name");

  3. josalmon
    Posted 8 years ago #

    Brilliant! Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.