• Resolved wwwolf

    (@wwwolf)


    I’m trying to create a LCP template to replace the functionality of ‘Post Index’ plugin that has been abandoned. The link to the ‘page I need help with’ shows what I’m trying to replicate, rather than any attempt, since my php skills and WordPress knowledge are rather basic, so I haven’t gotten very far yet :O

    I think the key php functionality needed to use is the following (found on StackExchange, props Sean bright) – obviously a generic example querying the SQL database directly – but how to adapt it into LCP/WordPress for (a) the clickable index at the top and (b) the list itself is defeating me:

    
    $result = mysql_query("SELECT user, name FROM users ORDER BY name");
    $last = '';
    
    while ($row = mysql_fetch_array($result)) {
        $current = strtolower($row['name'][0]);
        if ($last != $current) {
            echo strtoupper($current) . "<br />";
            $last = $current;
        }
        echo "<a href=\"/artists/artist.php?user=".$row{'user'}."\">".$row{'name'}."</a><br />";
    }
    

    I’m posting here because I suspect this could be quite popular for sites with a lot of posts, as either a functionality option within LCP (though probably not, as it’s more than could be triggered by a shortcode option), or as an ‘add-on’ downloadable template, so I’m hoping someone with more WP development experience might pick this up as fun/useful ??

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Template for alphabetic index with letter headings’ is closed to new replies.