• Hello,

    I was wondering if it’s possible (with the use of a widget) to list (titles only) all posts of one specific category one a different page? If so; could someone send me a link or tell me how?

Viewing 1 replies (of 1 total)
  • Here is an article on creating a shortcode to list post titles.

    You can adapt it to list one category by altering the $sql variable. The value should be like this:

    $cat_name = "Beaches";
    $sql = "SELECT SQL_CALC_FOUND_ROWS ID, p.post_title
       FROM $wpdb->posts p
       JOIN $wpdb->term_relationships tr ON ( p.ID = tr.object_id )
       JOIN $wpdb->term_taxonomy tt ON ( tr.term_taxonomy_id = tt.term_taxonomy_id )
       JOIN $wpdb->terms t ON ( tt.term_id = t.term_id )
       WHERE p.post_type = 'post'
          AND p.post_status = 'publish'
          AND tt.taxonomy = 'category'
          AND t.name = '$cat_name'
       LIMIT $offset,$posts_per_page";

    Then, just use the shortcode on a Page.

Viewing 1 replies (of 1 total)
  • The topic ‘Archive for categories?’ is closed to new replies.