Forums

[Plugin: Blogroll Links Page] Hack to ORDER BY parent category name (2 posts)

  1. LawyerGeek
    Member
    Posted 5 years ago #

    Thanks for the great plugin. Just wanted to share the change I made to order by parent category name. I joined the tables wp_term_taxonomy and wp_terms to get the category name from wp_terms; then ordered by name. My modified version of the plugin code that generates the SQL query to retrieve the parent category is below. I hardcoded the table names and relied on the default sort order; but this could be made more elegant and general, I'm sure.

    Following is the modified code.

    // Get parent categories only
    $sql = "SELECT wp_term_taxonomy.term_id, wp_term_taxonomy.term_taxonomy_id, wp_terms.name FROM " . $table_prefix ."term_taxonomy, wp_terms WHERE wp_term_taxonomy.taxonomy = 'link_category' AND wp_term_taxonomy.term_id = wp_terms.term_id ORDER BY wp_terms.name";

    http://wordpress.org/extend/plugins/blogroll-links-page/

  2. Mark Allen
    Member
    Posted 5 years ago #

    Cool - thanks. I'll look at turning this into a proper patch soon.

Topic Closed

This topic has been closed to new replies.

About this Topic