WordPress.org

Ready to get started?Download WordPress

Forums

more than one post page (27 posts)

  1. deltina
    Member
    Posted 7 years ago #

    I have searched for a few days, and can't seem to find a solution to this. What I need is for there to be another page that will list only certain posts, since I need them to have a different format, as well as be listed away from the other blog posts.

    I am quite experienced, and will write a plugin if absolutely necessary, but thought I would check here for solutions first. I would rather not hack the code, though, since I want to keep my upgrades clean.

  2. MichaelH
    Member
    Posted 7 years ago #

    "another page that will list only certain posts"

    How would you identify those "certain posts?"

    If you could assign those posts a specific Category, then you might consider using a Category Template to display those posts.

    Otherwise you could use a Page and associate it with a Page Template that makes use of The Loop.

    Additional Resources:
    Stepping into Templates
    Template Hierarchy

  3. deltina
    Member
    Posted 7 years ago #

    How would you identify those "certain posts?"

    By category would work. So I will try to use cataegory templates.

    But, I also want a separate page (or navigation item, really) that will take them directly to the posts in this category, as though it were a completely separate blog or "news item" list.

  4. MichaelH
    Member
    Posted 7 years ago #

    But, I also want a separate page (or navigation item, really) that will take them directly to the posts in this category

    That can be done via the template tag, wp_list_categories. Take a look at the WordPress Default 1.6 theme's sidebar.php file (wp-content/themes/default/sidebar.php) for an example.

  5. deltina
    Member
    Posted 7 years ago #

    This will help add it as a link in a sidebar, yes. But what if I want it to show up in my custom page navigation menu? Would I just add it to the end, outside of the "page" structure with a link to the posts in that category? Hope that makes sense...

  6. MichaelH
    Member
    Posted 7 years ago #

    How do you present your "custom page navigation?"

    Is a link available to see that?

  7. deltina
    Member
    Posted 7 years ago #

    it is just a simple navigation menu at the top of the page - i prefer not to post URLs to my sites - i have been bitten more than once...

  8. deltina
    Member
    Posted 7 years ago #

  9. MichaelH
    Member
    Posted 7 years ago #

    Since the menu navigation uses wp_list_pages any page you create will show in that top navigation menu.

  10. deltina
    Member
    Posted 7 years ago #

    yes, that is right; so that brings us full circle to how i make a page that list all the posts in one category...

  11. Chris_K
    Member
    Posted 7 years ago #

    This might be a good use for the redirectify plugin... basically, you build a dummy page that does a redirect (in your case) to the appropriate category page.

    Or you hard code add a link to the theme at the end of the page list for your category page.

  12. deltina
    Member
    Posted 7 years ago #

    yes, hard coding it would work (i prefer not to redirect if i can help it)

    except that i use page templates as well - so would doing a category template work, then?

  13. Chris_K
    Member
    Posted 7 years ago #

    except that i use page templates as well -

    while will have no effect on your category list. No harm.

    so would doing a category template work, then?

    If you'd like the category's page (ala Category_Templates) to look like a Page, then yeah -- make a template for that cat. (assuming I'm following what you're after!)

  14. deltina
    Member
    Posted 7 years ago #

    yes, i have custom headers for each page, and i will need a different header for this page, than from the regular blog page, so instead of a page template, i am hoping a category template will help me accomplish the same thing

  15. deltina
    Member
    Posted 7 years ago #

    yes, that did it! the only other thing i need to do is get the plugin that let's me exclude categories from the main loop, since i only want these entries on the "news" page

    or do you think i should just hard code that?

  16. Chris_K
    Member
    Posted 7 years ago #

    Oh heck, I thought I'd already posted the plugins to this thread. There may be others, but I believe one of these two will simplify the cat exclude:

    Category Visibility plugin.
    Ultimate Category Excluder plugin.

    Granted, if you intend to stick with your theme for a while, massaging The_Loop is certainly an option.

  17. deltina
    Member
    Posted 7 years ago #

    thanks ok, i already knew about them
    but i went ahead and excluded the category from the loop
    as much as i am customizing this theme, i doubt i will be
    changing it up any time soon

    this is great - it looks like we got it!

    thanks!

  18. deltina
    Member
    Posted 7 years ago #

    ok, one more thing
    when i click on the permalink
    it shows nothing because i told it
    not to show posts from that category
    i realize there are a number of ways to remedy this
    but how would i show a "single" in one category
    with one template - and the rest in another?
    do you see the problem?

  19. deltina
    Member
    Posted 7 years ago #

    for the record, what i did was add a single.php file
    and opted for one particular template style for all singles
    but it would be nice to know if there is a way to show
    single posts with the same category template they belong to

  20. Chris_K
    Member
    Posted 7 years ago #

  21. deltina
    Member
    Posted 7 years ago #

    very sweet!
    i will post here if this solves the issue
    thanks!

  22. deltina
    Member
    Posted 7 years ago #

    ok, that did it
    i haven't had a chance to test
    with the end user yet
    but this looks like it will work very well
    thanks!!

  23. Chris_K
    Member
    Posted 7 years ago #

    Awesome. Glad to hear it. :-)

  24. jakelyman
    Member
    Posted 6 years ago #

    Deltina,

    Is there any chance you'd be willing to do a step by step explanation of what you did to get this working? I've been scouring the forums, docs, and trying to figure out template categories and template pages to achieve exactly what you were asking four months ago and have yet to find a comprehensive explanation of how it works.

    I'm definitely willing to "slog" through the multiple posts that address this question in a peripheral way as I know I'll learn a lot by wrestling with this. But I'd love to see a . . .

    Step 1. Create a category template
    Step 2. Modify it "this way"
    Step 3. Go to . . .

    That would be amazing. If you can't do it, then I'll definitely try to create a doc like this myself once I've figured it out. It seems like there are at least a few people who want this functionality.

    Thanks, everyone, for the kindness you show and the hard work you perform on behalf of total strangers. It's amazing to come to a community of people who don't know one another but are willing to give freely of their time.

    Jake

  25. makemead
    Member
    Posted 6 years ago #

    I do this a different way. I installed the customizable-post-listings plugin and assign different categories to different pages. Basically, I have each page showing one category each but you can separate it any way you'd like.

    I've used this technique at staffstone.com and eaglesnestministries.com

    I've modified page.php in the following way:

    switch ($post->ID) {
    case '9': /* page ID */
    $cats = '8'; /* category to show */
    break;
    
    case '10':
    $cats = '9';
    break;
    
    <snip>
    
    default:
    $skip = true;
    }
    if (!$skip) {
    c2c_get_recent_posts ($num_posts = 15, $format = "<h3>%post_URL%</h3>%post_content%
    <p class=\"time\" style=\"border:none;\"><a>%comments_fancy%</a>
    <p class=\"time\">%post_date%
    ", $categories = $cats, $orderby = 'date', $order = 'DESC', $offset = 0, $date_format = 'F jS, Y', $authors = '', $include_passworded_posts = false);
    } ?>
  26. jakelyman
    Member
    Posted 6 years ago #

    Makemead,

    Thank you. I'm going to give your suggestion a shot. Can I ask, when you say that you,

    assign different categories to different pages

    do you mean that you go into the customizable-post-listings plugin's php and edit the code or that you make changes within wordpress to assign categories to different pages?

    Thanks!

  27. makemead
    Member
    Posted 6 years ago #

    I meant that I assigned different categories using my switch statement in page.php

    switch ($post->ID) {
    case '9': /* page ID */
    $cats = '8'; /* category to show */
    break;

    case '10':
    $cats = '9';
    break;

    That means that the page with the ID of 9 gets all posts with the category ID of 8

    The page with the ID of 10 gets all the category 9 posts.

    If you look at your "Manage -> Pages" control panel it give you the ID number of the pages and if you look at "Manage -> Categories" control panel it give you the ID number of the categories. Then you just have to add more to the switch statement. The default part of the switch statement allows all of your regular pages to have no posts added to them.

Topic Closed

This topic has been closed to new replies.

About this Topic