Customized Query in Wordpress

September 18, 2007 · Print This Article

HTML:
  1. <?php
  2. $get_children = $wpdb->get_results('SELECT * FROM your category table WHERE category_parent = "The cat_ID of the parent that you want"');
  3. foreach ($get_children as $child) {
  4. echo '<li><a href="./?cat='.$child->cat_ID.'" title="View all posts filed under '.$child->cat_name.'">'.$child->cat_name.'</a></li>';
  5. }
  6. ?>
  7. </ul>

Random Posts

Comments

Got something to say?