The problem is that each time you start a new letter, you don’t close the list of the previous one.
Inside your check if ($this_letter != $curr_letter)
, before the echo
, you have to add a </ul>
in all cases except when $curr_letter
is empty (the first letter).
if ($this_letter != $curr_letter) {
if('' != $curr_letter){
echo '</ul></div>';
}
echo "<div class="letter_item"><h2>$this_letter</h2><ul>";
$curr_letter = $this_letter;
}
Related Posts:
- simple sql query on wp_postmeta very slow
- How to Use Wildcards in $wpdb Queries Using $wpdb->get_results & $wpdb->prepare?
- wordpress query – orderby child post date
- Compare two numeric custom fields
- Custom query filter not working on woocommerce category page
- How to delete a transient on post/page publish?
- How to extract all ID variables from a query string?
- WordPress creating excessive joins on meta_query with search
- How to display liked posts of current user in wordpress?
- How to tell if $query_var isset?
- Sorting Grids with Essential Grid and Events Manger
- The use of including upgrade.php when building custom queries
- Remove Unnecessary Mysql Query
- Get the timout value of a saved transient?
- Grouping related postmeta data via SQL query
- Does meta_query work within get_posts array?
- How to remove duplicate query on page load or make them cacheable
- How to show more than 5 posts?
- wpdb::prepare() isn’t working
- How can I apply a meta query for a single custom post type in the main query?
- WordPress Find Duplicate Post By Content
- how to query multiple categories in wordpress?
- Huge amount of queries on my site
- Using pre_get_posts to target a query in the sidebar
- Update slug (URL) of pending posts via phpMyAdmin
- How do I use get_query_var() within plguin code
- How to display related posts by same publish date?
- where should I reset query after using get_results?
- Get post according to current taxonomy
- Exclude featured image and custom field from this get_attachment query
- Ordering by a metadata subfield in WordPress?
- Alter query with posts_clauses to retrieve NULL values last
- Query based on title, with ‘compare’ => ‘IN’
- Issue with using add_rewrite_rule() for post querying custom fields
- Form and custom query problem
- Export Specific User data without plugin
- Plugin will sort users by usermeta
- Exclude all sticky posts front page twenty twelve
- Query posts according to specific post meta values
- get csv of users with user_meta
- empty query breaks other queries
- Problem in exploding the_content to array
- What is wrong with my wp query, cant exclude the category that i want
- how to insert missing tags into the posts through mySQL?
- How to write update query in WordPress to expire transients
- Query Nickname rather than Display Name in custom Woocommerce plugin
- get posts by tag to showing in a widget
- Get previous posts list
- how to replace old DW site with new WP site? [closed]
- Mysql query not working on WordPress 4.2.2
- get_post_meta with WP_query
- Taxonomy filter under Polylang
- How to create an overview of posts with the same tag?
- List WordPress Post and Related Attachments outside of a post page
- How properly create a blog template for wordpress?
- Is there a way to add a link directly into this media query?
- create a link to a random post within the current category
- Problem on displaying the results on my query
- Improve performance of slow query
- JetEngine Query Builder – order by value from repeater
- Change pure SQL database query to WordPress post query?
- WordPress search in modified post title
- meta_query not working
- Cannot get sql request from Query object?
- WordPress query: merge meta key (number) values and sort
- Heavy meta query causing SQL crash
- Question about of query
- Is there any way to get all custom posts and all custom terms with it’s meta in few queries?
- Modify behaviour of “s” parameter in wp_query
- Sort by postmeta on when searching
- Pulling an ACF into a query
- Speed up search query that searches in post meta?
- How to make MySQL search queries with quotes
- Limiting a filtered query
- Using cron for multiple queries
- Archive query not working correctly
- Custom MySQL Query for Post and Post Meta
- very slow wordpress query with default query
- Displaying popular posts
- Custom Query problem access the values
- Set posts per page for parent category and it’s all children
- How to have more post in a page than in your home page
- Find all posts via SQL beginning with A of type B
- learn to run wpdb class
- Display old posts if no future posts exist
- Access Tables with number prefix
- how to add a read more button to my blog page?
- Rewrite Query_Var URL Parameter with Slug
- How to query different categories on index?
- Can’t See Media Queries with Inspect Tool [closed]
- How to add multiple values with add_query_arg?
- Query parsing only author ids
- 3 queries to update WordPress
- How do I troubleshoot Maximum execution time of 60 seconds exceeded in updating a Media File?
- update $wpdb one query
- Admin Post List table Query filtering “WHERE” for custom post type
- Ascending & descending posts on same page with IF statement
- Prevent executing query for wp_global_styles
- How to use a dynamic term id for the query block
- Meta Query compare with LIKE pulls similar post types: 55 and 155, and 1,155