views:

219

answers:

1

Hi,

Can you help.

Wordpress can be altered in many ways.

  1. in the loop or just before
  2. in the functions.php file
  3. in the includes/posts.php

I want number 3. As the other two do not work in carringtons theme. I have already edited this file and it worked perfectly. Alas it was so long ago that i have forgot how its done. It got removed when i upgraded.

Please help

A: 

This should get you the IDs of posts in a certain category sorted by their titles:

$postsInCat = $wpdb->get_results( "SELECT wpr.object_id
    FROM wp_terms
    INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id
    INNER JOIN wp_term_relationships wpr ON wpr.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    INNER JOIN wp_posts p ON p.ID = wpr.object_id
    WHERE taxonomy =  'category'
    AND p.post_type =  'post'
    AND wp_terms.name =  \"" . $category->cat_name . "\"
 ORDER BY post_title" );
Oren