Support » Fixing WordPress » How do you put separate posts on a page in your header bar?

  • I’ve got my blog setup and wanted to know if it was possible to write blog posts and have them published on a page in the page menu below the header.

    Basically…I want to be able to write blog posts and be able to have them published in a page in my page menu instead of on the main page where all the other blog posts appear. Is this possible?

    If so… How do you do it?

Viewing 15 replies - 1 through 15 (of 20 total)
  • Thanks stvwlf. I’ll check it out.

    I took a look at the loop. It’s too much code to deal with. I guess I’m just screwed.

    what is the site url?

    what you want to do is not hard. You already have some of what is needed in place because you have posts assigned to categories, which is needed.

    Each horizontal menu item you want to add requires a WP page (not a post). Give it the title you want:

    News Entertainment Humor whatever

    The first step is making sure your theme is auto-adding these pages to your horizontal menu. Some do, some don’t. If not they have to be added to the header.php file individually. If they are added and are in the wrong order, edit the page # of the page, on the editor page. Pages are ordered from lowest to highest page #. They don’t have to be 1-2-3-4 you can leave gaps.

    The simplest way to tell WP what posts you want on a page is to create a custom page template for each page you want on the menu.

    copy the page.php file in your theme folder and make new files named things like page_news.php page_humor.php

    Add lines like this at the top of each of those pages:

    Template Name: Humor Page

    now when you look at the page you made in the editor, you will see a section called Page Templates. Assign the Humor Page template to the page you created called Humor, etc etc.

    Now you have to add one line of code to each template page to tell it which post categories to include on that page.

    If you want categories 5, 9, 11, 15, and 23 to be on the humor page, your line of code looks like this:
    <?php query_posts('cat=5,9,11,15,23'); ?>

    You put that just before
    `<?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>`

    For each special page template you have made, change the query_posts statement to include the category codes for that page.

    If you only want one per page it looks like this
    <?php query_posts('cat=5'); ?>

    Its not very hard.

    Thank you so much. I will try this now, and pray I get it right.

    I think i understand all of this, but how do you create a php file?

    copy the file page.php to a new one, such as page_humor.php

    you will either need an FTP program with FTP access to your website, or else to log into your hosting control panel and use the file management utility there.

    there is also a WordPress FTP plugin but I will leave it to you to find that if you feel that is helpful. I suggest another method.

    FTP will allow you to put new theme files you create on your local computer onto your webserver. Just make sure you are not overwriting any files with the same name on the webserver and you will be OK.

    I’m using filezilla for ftp. But they don’t have a function that allows you to open or edit php. Maybe I have to find a php editor? That’s what I’m doing now. I’m lost, but hopefully that’s what I need.


    do this

    download page.php to your computer

    change its name to page_humor.php (or whatever you want to call the page template.

    make the changes i suggested in the other post to that file.

    then drag the file back up to your theme folder

    MAKE SURE YOU HAVE CHANGED THE NAME to the new name before you load it on the server, so you don’t write over your page.php file

    that is how you can create a new php file

    normally you just create a new text file and change its name from file.txt to file.php, and put your php code in it.

    you don’t need a special PHP editor for the small amount of programming you are going to be doing. Even notepad will do just fine. Any text editor. Not a word processor.

    Holy S**T!!!!!!! I got it to work. You are the greatest ever. I’ve been browsing the forums trying to figure this out for a month and know one knew what they were doing except for you.

    This just brightened the hell out of my day!!!

    good for you!!!

    NOW, if you are gonna make one page per category, you are going to have to look into drop down menus pretty quickly, because you have a LOT of categories! way too many for a single row of horizontal menu choices

    keep at it, this stuff is not all that hard

    I actually only need about 3 pages, so this will work really well. Just one more question… How do I prevent posts from going to my main page and only going into their category?

    to keep posts off the main page, put this line before the loop

    <?php query_posts('cat=-5,-9,-11'); ?>

    the minus signs mean “exclude this category”

    your main page is probably driven by index.php, unless you’ve set up a static home page. if you have you will have to figure out which file to add that line to, by trial & error

    i was reading about you on your site. good for you, is what i say. just keep trying stuff, such as this. and your ventures. you will find your own way to do stuff – you have the right attitude.
    take care

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘How do you put separate posts on a page in your header bar?’ is closed to new replies.