WordPress.org

Ready to get started?Download WordPress

Forums

Blog Category as Page? (5 posts)

  1. johnstewart
    Member
    Posted 7 years ago #

    http://johnstewart.com/

    I run a regular poker game, and post results under a particular blog category ("MSOP Results").

    I've got a bunch of pages about the game schedule, rules, etc. listed under Pages. I'd like to have a link under the Pages area which would take users to the MSOP Results archive directly.

    Any ideas?

    I see that archive.php can detect which category its displaying using the is_category() function. Howevere, I don't see any way to *set* the category (which would let me do this then by creating a page template which would set the category, display as archive.php does, and then create a Page which uses this template).

    thanks!

  2. moshu
    Member
    Posted 7 years ago #

    Wrong approach :) (the Pages thingy)

    What you need is a Category Template:
    http://codex.wordpress.org/Category_Templates

    Actually, if you don't need to have a different design then even the archive.php would do it - you just have to add a link to the wp_list_pages template tag > pointing to
    /blog/category/msop/; when you click that link the archive.php "knows" that it has to display only the posts from that category, without any conditional!

    So, if no need for special design for the posts in thsi category - just add a link to the template tag and you are done. Don't over-complicate it :)
    (hint: search to find topics here about adding a "home" link to the Pages list... the same idea applies for your case)

  3. johnstewart
    Member
    Posted 7 years ago #

    moshu - thank you for the response.

    you just have to add a link to the wp_list_pages template tag > pointing to<br />
    /blog/category/msop/; when you click that link the archive.php "knows" that it has to display only the posts from that category, without any condional!

    But the question is where to put that link? The link I want to include is http://johnstewart.com/blog/category/msop/

    However, how do I get this to show up under Pages? I've searched through the forum looking for tips. It does seem I could modify template-functions-post.php or sidebar.php to put the link to "MSOP Result" at the top or bottom of the Pages list... but not amongst them as a child category in the middle of the Pages list.

    I'm trying to make it look just like any other of the subpages of "Madison Series of Poker" in my Pages list.

    I looked throught the docs on what wp_list_pages can do... it has the option to exclude certain Pages, but I don't see anything mentioned as far as including links that aren't really "pages"... and how would I specify anyway that is is a subpage of a parent?

    http://codex.wordpress.org/Template_Tags/wp_list_pages

    thanks!

  4. moshu
    Member
    Posted 7 years ago #

    1. Of course, you cannot add anything in the middle of the list, or among the childern Pages.
    BTW, you never mentioned this requirement, so my logical thinking was - you can add it at the end of the list.
    See http://wordpress.org/support/topic/33102?replies=32#post-188424
    (before and after... lots of posts)

    2. Another scenario:
    look for the Redirectify plugin:
    http://www.redalt.com/downloads/ - install it.
    Create a Page titled "whatever-you-want-to-appear" and using the plugin 'redirect it to your catgeory archive

  5. johnstewart
    Member
    Posted 7 years ago #

    Perfect (almost) =)

    Thank you; that's exactly what I was looking for. I've got Past Results as a subcategory here:

    http://johnstewart.com/madison-series-of-poker/past-results/

    Which is set with that plugin to redirect, but for some reason (I think this is a problem with my ISP) it's going to a static redirect error instead of actually redirecting. Probably some dumb setting on the HTTP server's part.

    thanks, though! This is exactly what I was looking for... a start!

    johnS

Topic Closed

This topic has been closed to new replies.

About this Topic