Support » Fixing WordPress » Use page as category?

  • Resolved Ignacio

    (@subwaydesign)


    I´m sorry if this has been already asked, but i couldn´t find it anywhere.

    What i need is to add the code on a page to display as a category.
    This is so i can have the pages and categories in only one menu.

    i.e.: i go to the page “about us” and it shows (as if it was redirecting) the category 1, that includes all posts on who we are…

    can it be done?
    thanks in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Eric Amundson

    (@sewmyheadon)

    Volunteer Moderator

    You can do this using several different methods.

    One would be to really just have a custom category page that pulls only posts from a single category.

    Another would be to have a page with a custom loop that only does the above.

    You may want to read some of the docs like:
    http://codex.wordpress.org/Templates_Hierarchy
    http://codex.wordpress.org/Templates_Hierarchy#Category_page
    http://codex.wordpress.org/Category_Templates
    http://codex.wordpress.org/The_Loop

    Ignacio

    (@subwaydesign)

    One would be to really just have a custom category page that pulls only posts from a single category.

    that´s exactly it!
    but even though i read the articles you sent me (i really did), i couldn´t figure out how to do that. i know it should be really easy, but the loop examples don´t show how to limit it to a category, but how to exclude one…

    any further info will be really appreciated! 🙂

    Eric Amundson

    (@sewmyheadon)

    Volunteer Moderator

    Look on the Category_Templates page under “What categories do you show to the visitors? “ – I think that’ll get you what you need.

    Ignacio

    (@subwaydesign)

    thanks a lot for your help!
    i finally solved it.

    if someone needs to do this, here´s the solution.
    i was using k2 as theme, so i made a new template file like this:

    <?php /*
    	Template Name: Category id 5
    */ ?>
    
    <?php get_header(); ?>
    
    <div class="content">
    	<div id="primary">
    		<div id="current-content" class="hfeed">
    
    		<?php query_posts('cat=5&showposts='.get_option('posts_per_page')); ?>
    
    		<?php include('theloop.php'); ?>
    
    		</div> <!-- #current-content -->
    
    		<div id="dynamic-content"></div>
    	</div> <!-- #primary -->
    
    	<?php get_sidebar(); ?>
    
    </div> <!-- .content -->
    
    <?php get_footer(); ?>

    as you can see, i used the query_posts to limit it to category 5. then, i created a new page in wordpress that is almost empty, but on the bottom i selected this template file.

    as easy as that!

    Still don’t get it

    Is there any better tutorial for this?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Use page as category?’ is closed to new replies.