• I am just getting started with wordpress and I am very new to PHP and I need a little guidance.

    I want to create a web site that has a menu with four pages. The home page will display all recent posts and function as a traditional wordpress home page. On the pages that are in the menu I want to display posts from a specific category.

    For example: my menu across the top of the page reads…
    HOME EVENTS REVIEWS

    How do I create a ‘page’ that contains only posts from the events category? Also how do I get WordPress to place it in the menu as it would a page?

    I think I can place a Loop into a Page template as described here:
    Exclude Posts From Some Category

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Why do you want to use a Page? WordPress creates Category archives automatically.

    Look closely at wp_list_categories.

    Hi,

    i suggest you use

    <?php wp_list_categories(); ?>

    in your top menu (i presume header.php) so that you automatically get links to your specific categories

    read here how you can exclude categories and change sort order etc.

    That’s it!

    Thread Starter 815674

    Perhaps I am misunderstanding or vice versa. I don’t have a test page up yet but I am going to use http://www.webdesignerwall.com/ to describe what I am trying to do.

    The site has two menus. The main menu Home | About | Archives and the blog sub-menu Tutorials | Trends | General.

    How do I create a menu that would place the blog sub-menu links in place of the main menu. So the main menu pages would be Home | Tutorials | Trends. Tutorials would be a page that shows only posts from the category tutorials.

    I think this is more of a layout issue than anything else but I am not sure.

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    Good post moshu! I’d suggest including something about using wp_list_categories to generate additional LI’s for that sort of thing as well.

    Yes, i think you are misunderstanding

    if you open your theme’s sidebar.php you will see the line we mentioned earlier: <?php wp_list_categories(); ?>

    this line makes that you get the links in your sidebar (like tutorials/trends/general)

    now, you do not want them in your sidebar, so you need to remove this part of the code from sidebar.php and put it in the file that regulates your topmenu (probably header.php)

    that’s all you need to do (and maybe change come CSS properties to make it look fine)

    i hope you understand what i’m saying..

    Done 🙂

    thank you rmk 80 your explanation made perfect sense.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How do I create pages containing posts from a specific category?’ is closed to new replies.