Category to Page how to

Discussion in 'WordPress' started by Exellero, Sep 26, 2010.

  1. #1
    Hello. I created some pages in WordPress and now i want to add post from specified categories but i cant get it to work.

    As an example my site: www.net-flux.com
    You can see that the page News is empty while the category news has some random posts i put. How do i link categories/posts to pages?

    Thank you.
     
    Exellero, Sep 26, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There are three ways you can do this. The easiest way is to just use a plugin, like Page Links To or Page2Cat

    The second way is to write a page template, which is good if you don't like using plugins.
    Wordpress - Creating Your Own Page Templates

    Copy your page template (page.php) and rename it to news.php, or whatever you think is appropriate. Just make sure it's not a reserved filename.
    Open it in the theme editor and put the template comments at the top. Then, put a query_posts line just before the loop starts. It should look something like this:
    
    <?php
    /*
    Template Name: News
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="container">
    <div id="content" role="main">
    			
    <?php query_posts('cat=57'); ?>
    
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    Code (markup):
    Then, edit your news page and select the news template from the drop-down box on the right side.
    If you make another template, change the template name and the category ID (cat=57) to the right ones.

    The third ways is to install a PHP plugin and use the get_posts function directly in the page content, but I wouldn't bother doing that.
     
    Last edited: Sep 26, 2010
    Cash Nebula, Sep 26, 2010 IP
  3. Exellero

    Exellero Peon

    Messages:
    41
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i tried page2cat but it does not work
     
    Exellero, Sep 26, 2010 IP
  4. machimanmarker

    machimanmarker Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    are you sure, i recommend you reinstall
     
    machimanmarker, Sep 30, 2010 IP