Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global $wpdb,$post;
- $request = 'B';
- $results = $wpdb->get_results(
- " SELECT * FROM $wpdb->posts
- WHERE post_title LIKE '$request%'
- AND post_type = 'product'
- AND post_status = 'publish';
- "
- );
- if ( $results ) {
- foreach ( $results as $post ) {
- setup_postdata ( $post ); ?>
- <li>
- <?php echo $post->post_title; ?>
- </li>
- <?php
- }
- } else { ?>
- <div class="alert">No posts found for this particular letter.</div>
- <?php }
Add Comment
Please, Sign In to add comment