Wordpress - Custom Pages

Discussion in 'WordPress' started by phgonline, Apr 9, 2009.

  1. #1
    Hey,

    I'm trying to create a custom page that will display a single categories post alphabetically, not all categories.

    I found this.. http://codex.wordpress.org/Alphabetizing_Posts

    I created the custom file with the category id as the file name added the extra code before the loop. I then create a page from the admin panel and use the file as my page template, when I try to view it nothing shows. Not really sure how wordpress knows which category to select.

    Any help would be great!

    Thanks
     
    phgonline, Apr 9, 2009 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Cash Nebula, Apr 9, 2009 IP
  3. phgonline

    phgonline Peon

    Messages:
    333
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey,

    Yeah, what I don't understand is how to alphabetize a single category, wordpress does this automatically with category pages but I want to only do this to 1 category. Which is why I am creating a custom page. Do you know how to "call" a specific category to show?
     
    phgonline, Apr 10, 2009 IP
  4. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #4
    
    <?php
    $getposts = get_posts('category=ID&order=ASC&orderby=title&numberposts=-1');
    foreach($getposts as $post) :
    ?>
    <h2><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a><h2>
    <?php the_excerpt(); ?>
    <?php endforeach; ?>
    
    Code (markup):
    Just replace ID with with category number. Hope it works, I didn't bother testing it. :eek:
     
    Cash Nebula, Apr 10, 2009 IP
  5. phgonline

    phgonline Peon

    Messages:
    333
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Used parts of your code and got it to work, Thanks!
     
    phgonline, Apr 10, 2009 IP