WordPress.org

Support

Support » Themes and Templates » Custom category list with post titles

Custom category list with post titles

  • Hello,
    php noob here, looking for a little help with a category list with post titles listed under
    example:

    /category title
    / / post title
    / / post title
    / / post title
    / / post title

    /category title
    / / post title
    / / post title
    / / post title
    / / post title

    Any help would be greatly appreciated as I am completely stuck on this. Thanks!

    blockquote
    <?php
    if (is_category()):
    $cat = get_the_category();
    $cat = $cat[0];
    ?>

  • <span class=”blogroll_title”>
    <?php
    foreach((get_the_category()) as $cat) {
    echo $cat->cat_name . ‘ ‘;
    } ?>
    </span>
    <ul id=”first_title” class=”inner-list”>
    <?php $my_query = $wpdb->get_results(“SELECT $wpdb->posts.* FROM $wpdb->posts, $wpdb->post2cat WHERE category_id = ‘$cat->cat_ID’ AND ID = post_id AND post_id <> ‘$id’ AND post_status = ‘publish’ ORDER BY post_date DESC LIMIT 10”); ?>
    <?php while(list(,$my_post) = each($my_query)) : ?>
    <li id=”post-<?php echo $my_post->ID; ?>”> ID); ?>” rel=”bookmark” title=”Permanent Link to <?php echo $my_post-> post_title; ?>”> <?php echo $my_post->post_title; ?>
  • <?php endwhile; ?>

    <?php endif; ?>
    blockquote

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom category list with post titles’ is closed to new replies.