Render a loop in Timber (twig for WordPress)
@Xroad, here’s the simplest way. Things can get a bit more complicated depending on the specifics, but this is the most straightforward way: $query = get_posts(array(‘post_type’ => ‘lexique’,’posts_per_page’ => -1)); $by_letter = array(); while( $query->have_posts() ) { $query->the_post(); global $post; $letter = substr($post->post_name, 0, 1); if ( ! isset($by_letter[$letter]) ) $by_letter[$letter] = array(); $by_letter[$letter][] = … Read more