Grow your CSS skills. Land your dream job.

Mixing static and dynamic content in navigation

  • # October 3, 2009 at 9:03 pm

    I’m making a website for a composer who wants to have separate pages for several different kinds of posts: a news page, a video clips page, a page for reviews he’s gotten, a blog page for more at length writing, upcoming events, etc. He wants to include these in the main navigation, some of them as sub menus, alongside other static pages like his bio. The site is still very much in development, but just to see the structure I’m talking about, you can go check it out: http://noamfaingold.com/wordpress (oh christ, I can’t use HTML? of all the places to use BBCode…). My current plan is to go through and have custom page templates for each page that has a separate query_posts and loop for the different types of content. Obviously, this functionality is already in place with categories, but I don’t know if it’s possible to include category pages in the same navigation list as static pages without just hard coding it in. If there is some way to do this, let me know, it’ll save me a bit of time.

    In an entirely separate question, when I watch Chris’s screencasts, it looks like Coda automatically uploads changed files (perhaps when he saves them?) and then gives him a little pop up to tell him it’s done. I use Coda, but it doesn’t seem to do these things out of the box. Is there a plugin I haven’t found yet that will do this? Seems like it would definitely speed up workflow by about 2/3 of a second every time I want to upload and then check it out in the browser, which would totally be worth it.

    Thanks people!

    # October 5, 2009 at 12:11 pm

    If you make separate page templates for each page, as is your goal. You’ll want to make separate pages in the WordPress Admin.
    Once that is done you could use WP_list_pages() to create the navigation. Then on each page template you could run the query_posts to filter the page to show only the posts you want by category using the following

    Code:
    query_posts(“cat=3″);

    Where the "3" is the category id (you can find category id by navigating to "Categories" in the WP Admin, and mouse over the "Edit" link for the category you want. The status bar at the bottom of your browser will show the link and end in &CAT_ID=3 or whatever that categorie’s id is.)

    As for coda, if you are altering the files in "Remote" instead of "local" In the left column. You will be working directly on your server. so a save will automatically upload.

    as for posting html or any code here, you can click the code button and it will wrap your html in the proper "code" tags, and will display as in the above query posts example..

    # October 6, 2009 at 1:39 am

    Thanks blue642, that’s exactly what I was planning on doing. The problem is that this requires hard-coding each page with a different query_posts. It would be nice if I could just ask wordpress to output some of the category pages (like what I would get from wp_list_categories) into the same lists and sublists that wp_list_pages produces, instead of having to have a separate page template for each. Wouldn’t it be better if this could be done dynamically? The whole point of a CMS is that I don’t have to write new code for every page, right?

    As for the comment about not being able to use HTML, I should clarify that what happened was I wanted to give a link to the site, so I typed something like

    Code:
    go check it out

    only to find while previewing it that css-tricks, of all places, won’t read html tags in its posts, but instead requires that BBCode thing if you actually want to add tags to your posts, rather than just giving a code example. I’m sure it has to do with security and all that, but still…

    Editing remotely with Coda does upload as soon as I save, but it doesn’t give me that cool pop up I was talking about.

    # October 8, 2009 at 11:34 am

    Well, duh, I’ll use conditional tags to choose different queries depending on which page id I’m looking at. Now at least I don’t have to make 12 different page templates.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".