• Is there a function to display all posts as permenant links (like get_acrhives()) from a single catagary ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You could create a new template similar to index but that only shows the title and permalink. Then when you use the category list function, tell it which template you want to use (the new template you created).

    I’ve written a few lines to list all permalinks from all categories (result here : https://frenchfragfactory.net/ozh/index.php?a=archives )
    (there may be a way with built-in templates, but to be honest I didnt really search, I’m more like doing little things myself so I understand how php and mysql work)

    The code to do so is :

      <?
      $drafts=0;
      $posts = $wpdb->get_results("SELECT ID, post_author, post_date, post_title, post_category, post_excerpt, post_name, post_status FROM $tableposts ORDER BY post_date DESC");
      foreach ($posts as $post) {
      if ($post->post_status == "publish") {
      ?>
      <li class="even"><? the_time('d/m/y') ?> : " rel="bookmark" title="Permanent link : <? the_title_rss() ?>"><? the_title(); ?>

      <li class="odd"><? the_excerpt(true); ?> <span class="meta">In: <? the_category(", ") ?> <? edit_post_link("Edit this"); ?></span>

      <?
      } else { $drafts++;}
      }
      if ($drafts) {print "<li class=\"even\">... And still $drafts drafts to be published :)
      ";}
      ?>


    This needs to be included in a page with the proper header info ($blog=1, include wp-header, etc…, just like the top of index.php)
    To list only one category, add WHERE post_category=[number] in the SQL query string.

    Thread Starter pande

    (@pande)

    Thanks for SQL stuff, I tried it and works. But the problem is it’s showing only 4 entries from that Catagary. ANy clue. Yaa I am SQL n00b ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘To show all posts in a catagary ?’ is closed to new replies.