WordPress.org

Ready to get started?Download WordPress

Forums

Want to make a Page like a category page (5 posts)

  1. girlieleep
    Member
    Posted 8 years ago #

    What I want to do I would think is very simple, but I have not figured out a way to do it after searching like crazy, so i figured that maybe someone with more experience could give a newbie a quick answer.

    I want a Page (with a capital P) I have created called Video to look exactly like the page that is generated when I get the video category.

    So, I want:
    http://www.kristenleep.com/video
    to look exactly like
    http://www.kristenleep.com/category/video

    Any easy, fairly painless way to do this?

    Thanks in advance for your help. My head is spinning between trying to read about loops and php stuff. It's all running together and I know that a Page with a capital P acts a little differently.

  2. tsguitar
    Member
    Posted 8 years ago #

    Try this plugin:
    http://dev.wp-plugins.org/file/front-page-cats/trunk/front_page_cats.php

    Just change if (! $wp_query->is_home) { to if (! $wp_query->is_page('pagename') { (and change pagename, obviously). Here's more on the is_page() thing:
    http://codex.wordpress.org/Conditional_Tags#A_PAGE_Page

    Be sure to actually create a Page for that to display on before installing the plugin, though. The Page should be blank and should probably use the Archive Template (under "Page Template" on the right side).

    You can also try this. On your server, create a copy of archive.php and call it videocategory.php (or whatever you want, but I'll use that title here). Go to your theme editor (Presentation >> Theme Editor) and edit videocategory, which should now show up in the list of files on the right side. Right above <?php if (have_posts()) : ?>, paste this:
    <?php query_posts('category_name=Video'); ?>

    Now create a new Page and select videocategory as the page template. I've written all this in theory; I've never tried to do that, so let me know if it works! Here's some more info on this:
    http://codex.wordpress.org/Template_Tags/query_posts#Category_Parameters

  3. girlieleep
    Member
    Posted 8 years ago #

    Thanks for the advice...here's where I am in this process.

    I tried method #2 before, but I tried again with your instructions. What happens when I create the Video template page is that it displays a blank Video Page and then highlights the category name I requested over in the category list, but displays no actual posts, just highlights the category name. That's where it is now. Did I paste it into the right spot on my page? I posted the query_posts code above this line:
    <?php elseif (have_posts()) : ?>
    Is that the right spot for it?

    As for #1, I don't know if I understand it all completely. So, I go and copy and paste that into a file called front_page_cats.php ? Then where do I put that file? In the wp-plugins folder? I tried that, but it didn't show up as a plugin like a lot of plugins I have tried. My theme doesn't have an archive template, so should I make one based on the index page? (I am using a Theme called Freshy).

    Any clarification or other ideas? (I KNOW we have to be close on this). Basically I want that Page link at the top to function like a category page from a large link up by the lage list instead of a category link on the side. (Trying to make this really user-friendly for less savvy relatives and friends to use as a site.)

  4. girlieleep
    Member
    Posted 8 years ago #

    OK, so I figured it out with your help, tsguitar.

    In my index.php file that I copied, there were sections commented out. I knew we had to be close in that it highlighted video in the category list, but didn't display any posts. So, I took out the code that was labeled pages and changed the php elseif above to just a plain php if in the section labeled blog. Your number 2 idea worked and your explanation was awesome as to where to put that code.

    This issue has been resolved.

    Thank you so much for your help! I have learned so much about php this weekend, but my head is still spinning from code! :)

  5. tsguitar
    Member
    Posted 8 years ago #

    Excellent. I'm glad it worked. Can you mark this "Resolved"? And if you don't mind, could you possibly post the code you've successfully used? Don't forget to surround it with backticks. Thanks.

    "Took out the code that was labeled pages"? Huh? Sounds odd.

    The index.php file you copied, that's what became your template for this video page category, right? Why is there elseif on your index page in the first place, though? And is this the code that you put at the top of what you're using as your page template for this:
    <?php query_posts('category_name=Video'); ?>
    <?php if (have_posts()) : ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags