The comment from @czerspalace put me on the right track to doing what I needed. Since the first few terms start with numbers, this is how I implemented my solution:
// get results from $wpdb in object called $links
$glossary_ltr = "999";
foreach( $links as $link ) {
$kw_ltr = substr( $link->keyword, 0, 1 ); // get first letter
if( $glossary_ltr != $kw_ltr ) {
if( $kw_ltr > $glossary_ltr ) {
// code to transition to new letter
$glossary_ltr = $kw_ltr;
}
} // if letters are different
// print out term
echo "<a onclick='openTerm(/* term data */)'>". $link->keyword . "</a><br>";
} // foreach
Hope this helps someone else!
Related Posts:
- So much data in postmeta
- What is the advantage of the wp_options design pattern?
- Remove old custom field after import
- Edit Custom Database Tables in WordPress
- importing data from non-wordpress mysql db
- How to delete custom field “suggestions” from dropdown list
- Order posts by custom field and if custom field is empty return remaining posts
- Register new user and add custom data row value for it
- Calling Specific Pages with wp query Part II
- Loop through two different sets of custom fields
- After moving my site from a dev subdomain, to root, all my custom meta data is gone
- Front-end update_post_meta with ajax
- Advice needed for importing custom field data and database structure
- Leader board for game on homepage
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Default WordPress taxonomy (Tag) – How to add a custom field to form and save it to the database
- How do I exclude posts by custom field value?
- Echo values from custom field outside loop php
- Separate table or usermeta
- Custom User Profile Fields
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Calling custom fields for pages (not posts)
- Duplicate posts being displayed when querying Custom Fields
- Get all posts that do not have a specific custom field without using a subquery
- Loop to display random posts only if a custom field matches category
- How can I show custom fields in the loop only to specific user roles?
- get_posts that match a user-specified value on a page
- Custom fields not getting saved in the databse when added to the add new user profile page
- Accessing loop functions (e.g the_title or the_content) from post ID
- Is there any way to get all meta and standard columns for any WordPress object after searching based on meta key and value
- Limit the number of acf content when displaying in post loop [closed]
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Change the main loop WordPress impact on the server?
- custom-meta-box checkboxes from loop won’t save
- Linking Custom Fields to Database Records
- How to show a post if was published less than two hours ago?
- List users by sum of all their posts’ custom field values
- How to populate custom field dropdown box based on prior selection?
- Custom Fields – How to create a list from multi-line entries of a single value
- When creating a metabox do you have to create DB fields for the data?
- Limit of char count in WP custom fields
- how to make nsfw post with thumbanil
- Custom Query based on custom field of a single post
- Efficiently sort only certain categories by custom field
- Can I access a post meta field before the loop?
- Displaying page image in the footer automatically
- Show image if author meta (profile fields) exists outside loop
- Can’t query by meta_key
- Adding custom field and querying from post table
- How to copy data from a custom field to the post_content?
- Diamond question mark in text after migrating content
- ul list with only as many li’s as filled custom fields
- Loop through incrementing custom fields
- do_shortcode close
- Search Results Page – Displaying Custom Meta Fields
- How do I convert all custom_field php timestamps in the database to js timestamps?
- Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
- Collect Data from NEXT item while in loop
- How to show content of custom fields in search results?
- Custom field outside the loop and inside an array
- Display metabox title for custom fields with values
- use custom field value as post category in loop
- Getting and calculating averge value of custom fields of the same tag
- Filter or order based on custom field
- Compare ACF date field (if exists) and post date and order DESC
- How To Save Data From Remote APIs To ACF?
- What am I missing in this Code Block?
- get_field values for each post on home page using wp_add_inline_style
- when looping through custom post data not appearing
- User Filter Options on Archive Page
- Custom meta boxes – add php code inside?
- get wordpress post loop by meta box date
- Outputting custom field on home.php not outside of blog list
- Retrieving and inserting data in custom fields
- Counting number of images from loop
- Metabox value for post loop?
- I have a form with a custom button ,i want to add the field data to an database when clicking the custom button
- Get meta value when the page is a blog archive
- update_user_meta(): invisible data storage
- Populate a select box with data stored in the database?
- Updating custom fields with external data
- WP_query returns error when used for custom widget
- Download stuff after filling fields?
- I want my post to republish again after adding a custom field
- Display posts where date field matches current month?
- Filtering posts by WORD in custom field
- Retrieve IDs from custom field, count and display results differently according to count
- Pagination not displaying correct number of pages
- Display custom field outside the loop
- Website that sells statistics
- Custom field not showing
- Order by a meta field in query loop
- How to create a searchable database with a single-field search box at the front end? [closed]
- Specific coditional usage [closed]
- How to I make my post title link to a custom field
- How can I check if a custom field was updated?
- Get custom fields without _edit_last, _edit_lock, _wp_page_template and _visual-subtitle
- what would be a good example of a php dynamic code to display contents of textarea?
- Append custom field items to content from plugin
- custom field as a boolean with a checkbox?