Results 1 to 3 of 3

Thread: WordPress Theme: Display Posts in Category on a Page

  1. #1
    Senior Members' Member Matt1eD's Avatar
    Join Date
    Feb 2005
    Location
    London
    Posts
    2,462
    Thanks
    0
    Thanked
    0 times in 0 posts
    • Matt1eD's system
      • Motherboard:
      • MSI K9N6SGM-V GeForce 6100
      • CPU:
      • Athlon 64 LE-1620 2.41GHz
      • Memory:
      • 2 GB DDR2
      • Storage:
      • 1.25 TB
      • Graphics card(s):
      • Onboard
      • PSU:
      • eBuyer Extra Value 500W!
      • Operating System:
      • XP Pro

    Question WordPress Theme: Display Posts in Category on a Page

    My WP install (currently on a local machine) has a page called Welcome set as the front page under Settings > Reading. The posts page is set to a page called News. As you'd expect WordPress uses the theme and lays out the posts on that page.

    I have another page called Local News on which I wish to display posts which are in category ID 104, aka 'Local News.' I have created a copy of page.php (from my theme folder) and called it localnews.php. I have set the Local News page to follow this new template.

    I have taken the code from A Page of Posts only changing the top bit so it picks the right category...

    PHP Code:
    if (is_page('1186') ) {
    $cat = array(104);
    } elseif ( 
    is_page('') ) {
    $cat = array();
    } elseif ( 
    is_page('') ) {
    $cat = array();
    } else {
    $cat '';

    It is displaying the posts, however I have two queries.

    1) It doesn't seem to stop displaying posts; how can I set a limit and display an Older Entries link?
    2) It is not formatted like the News page, do I need to copy some code from somewhere?

    I could put a redirect in the code to a category page however I don't wish it to say categories and I have breadcrumbs installed so don't wish to lose all that formatting.

    If it affects anything it is a custom theme partially created in Artisteer.

    I have spent two days Googling and searching the WP forums for something which either I can understand (my PHP knowledge is far from extensive) or works for me. There are hundreds of similar things which didn't work for me so any help would be greatly appreciated. Thanks.
    Last edited by Matt1eD; 26-02-2010 at 12:26 PM. Reason: Added linik to A Page of Posts

  2. #2
    Senior Member
    Join Date
    Aug 2005
    Posts
    492
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: WordPress Theme: Display Posts in Category on a Page

    I've not got much experience with wordpress or PHP....

    $showposts = -1; // -1 shows all posts

    Set your limit there?
    | Intel 6400 | 2x1GB Corsair | Abit ab9 | 8800gt | Tagan 480w Psu | Xfi extreme music | Antec P182 | Dell 2007fpw|

  3. #3
    Senior Members' Member Matt1eD's Avatar
    Join Date
    Feb 2005
    Location
    London
    Posts
    2,462
    Thanks
    0
    Thanked
    0 times in 0 posts
    • Matt1eD's system
      • Motherboard:
      • MSI K9N6SGM-V GeForce 6100
      • CPU:
      • Athlon 64 LE-1620 2.41GHz
      • Memory:
      • 2 GB DDR2
      • Storage:
      • 1.25 TB
      • Graphics card(s):
      • Onboard
      • PSU:
      • eBuyer Extra Value 500W!
      • Operating System:
      • XP Pro

    Re: WordPress Theme: Display Posts in Category on a Page

    Thanks ja3h that works. Funnily enough I thought I'd tried that before, probably did something foolish like not saving last time!

    No Older Entries link created though

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. wordpress posts on front page...?
    By shiato storm in forum Software
    Replies: 5
    Last Post: 27-03-2008, 08:27 PM
  2. skype logo missing - making page display funny
    By ikonia in forum HEXUS Suggestions
    Replies: 1
    Last Post: 01-12-2006, 04:04 PM
  3. Replies: 3
    Last Post: 24-02-2006, 05:28 PM
  4. ATI Catalyst 5.8 released
    By =TcQi= in forum Graphics Cards
    Replies: 17
    Last Post: 18-08-2005, 12:35 AM
  5. How many posts per page?
    By silent ben in forum General Discussion
    Replies: 15
    Last Post: 03-05-2005, 09:33 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •