WordPress.org

Forums

Add a specific category to a query (1 post)

  1. richard.alienmedia
    Member
    Posted 1 year ago #

    Hi,

    I need to only display a certain category from a query:

    $letters = $wpdb->get_col(
    "SELECT DISTINCT LEFT(post_title,1) AS first_letter FROM
    $wpdb->posts
    WHERE post_type = '$post_type' AND post_status = 'publish'
    ORDER BY first_letter ASC"
    );

    Please could someone tell me how to do this? I haven't got the first clue!

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by richard.alienmedia
  • This topic is not resolved
  • WordPress version: 3.7.1