• I know this has been discussed before, but I wasn’t able to find the old post that detailed it.

    I’m trying to set up a page on my website that will read from the WP theme. Basically, I want this page to have its own sidebar, but use the header and footer from my blog, as well as any design elements attached to the theme (likewise, if I change the theme, I want this page to change too).

    I think that “Pages” in wordpress are not allowed to use PHP, which is why I can’t simply make this a Page in wordpress (because I want to use a separate sidebar). If I’m wrong, and Pages can use php to call up different sidebars, etc., please tell me how, because that would be much more convenient.

    Thanks for any help you can give!

Viewing 6 replies - 1 through 6 (of 6 total)
  • I’m using phpExec plugin to do this and it works fine. It allows you to call up php code from your pages:

    http://priyadi.net/archives/2005/03/02/wordpress-php-exec-plugin/

    Pages as well as posts cannot run PHP code that was typed in the content area.
    However, you can have 1 million Page templates that could call all different sidebars 🙂
    Just instead of the usual get_sidebar function (which would call the default sidebar) use a different line in the template:
    <?php include (TEMPLATEPATH . '/mysidebar.php'); ?>

    Thread Starter dminky

    (@dminky)

    Thanks guys, that helped a lot. I’ve gone with Moshu’s suggestion and wrote up a new page template.

    And this has given me another idea, which has raised another question. 😛

    Back in WP 1.5, I had a few separate Category pages… category-3.php and category-4.php, which defined separate rules for those categories. It also required a separate plugin to use, which of course I removed to install WP2.0, and it just occurred to me that it would be better organized for me if I turned these separate category designs into Pages as well, instead of making multiple category templates.

    So, my question: How would I set up a page template to call up a specific post category’s entries? (And I’ll ask now so I don’t have to ask later if I can’t figure it out — I want to have these posts sort descending instead of the WP default of ascending, as well as show all the posts on one page instead of dividing them among many pages. How can I do that on this page as well?)

    Thanks again! 🙂

    1. For using the category-x.php templates you don’t need any plugin! WP recognizes them automatically (since 1.5) and they work perfectly both in 1.5.x and 2.0.

    2. Why would you want to display posts of a category on Pages? instead of using the built-in feature of category templates? It just doesn’t make sense to me…
    You can modify The_Loop or simply install this plugin and you can have all different number of posts in different views:
    http://mattread.com/archives/2005/03/custom-query-string-plugin/

    Hi Moshu, I guess I have an answer to this question (“why would anyone display posts of a category on pages?”) as I’ve already done this. I am not a coder at all (more of a fiddler), so maybe there are better ways to do this (I still can’t even figure out how to get a custom sidebar page showing, but that’s another post).

    In any event, if you go here:

    http://cyberpunkreview.com/cyberpunk-movies-by-decade/

    This shows a Page that has all the posts from each of the various “sub-categories” for the category “Decade.” For some reason, I am never able to get my categories to show up in the category fields. I use higher level categories only as organizing levels such as “Decade” (with no posts) > “Movies from 1990-1999” (with lots of posts). Dennis from Semiologic claims the reason for this not working in categories (sub-categories with posts not showing up when the higher level one has no posts) is due to a bug in WordPress, and that he’s reported it. In any event, the way I have it works well enough for what I want.

    In any event, I used the phpExec plugin and then the Category Posts plugin (http://watershedstudio.com/portfolio/software/wp-category-posts.html) inside of it to create the type of page I want.

    Also, if you go and look at the bottom of any single post (movie review), I’m also trying to get all the posts from its child categories to show up in a customized sidebar. Again, I’m too stupid to figure this out yet, but I at least have them sitting at the bottom of the post.

    Thread Starter dminky

    (@dminky)

    ((1. For using the category-x.php templates you don’t need any plugin! WP recognizes them automatically (since 1.5) and they work perfectly both in 1.5.x and 2.0.))

    Woops, I didn’t make myself clear. The plugin I was using was to called something like “posts per page” and allowed you to have a different number of posts per page for each separate category. The one you linked to looks pretty similar to what I was using before, so I will give it a try. Thanks. 🙂

    ((2. Why would you want to display posts of a category on Pages? instead of using the built-in feature of category templates? It just doesn’t make sense to me…))

    I know what you’re saying, because prior to upgrading, this section of my site was just a category template.

    But my reason is (and I know this is kind of silly) I’d like this category to be listed among the “Pages” section on my sidebar. In my situation, the category I’m dealing with is a collection of of journal entries from a trip I took, and I’d like to separate it from the Category Archives because it is more than just a post archive.

    It also makes permalinks much nicer for this category if it is a page, because I could direct people to mysite.com/page rather than mysite.com/category/archive/

    So I guess basically the reason is because I’m not trying to make a category archive, but a separate page that includes all the posts from this category.

    I hope that makes sense… :-\

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Setting other pages to read from the WP Template’ is closed to new replies.