• Hi All,

    I am creating a sport site that needs pages with posts on them – what I mean is a page with details about a sports team and then have all the posts relating to them (already set as a category) to be posted below. There are approximately 100 teams so needs to be easily replicated – can any one point me in the right direction?

    Many Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’ve got something like this setup on a couple of pages. Menu shows pages of Team 1, Team 2, Team 3 etc. Each page shows only a specified category.

    Required editing the page.php or loop.php to include a “if then” loop. If page ID#4 then show category ID#13…

    I’ll try to get the URL and/or code to you…

    That code is inserted into a template php page like “blog.php” Then each page – Team 1, Team 2 etc. uses that template.

    http://upstairsroom.net/test

    Pets and Bears…. ( I know – silly example, but this was for someone else last week)

    Bears show “Grizzly” posts… Pets show “dogs” post. Combo shows both. Blog shows all posts including dogs and grizzlys…

    I’ll post the code ASAP…

    http://pastebin.com/944011S3

    This is the “blog” template based on WP twenty ten theme.

    You’ll see the php code has been inserted into the standard page.php. You’ll have to mod it to fit into your theme page.php. (or loop.php)

    So basically I inserted the php code into the page.php so it would still look like the regular page when it prints to screen and named it “blog.php”. You can add/change/remove the bylines, etc…

    Then each page, Bear, Pets, etc. or Team 1, Team 2, etc.. use the “blog” template.

    The code sees the corresponding page ID# and Category ID# and printes to screen.

    1) create each team as a category
    2) assign team post to a specific category, you can do it as multiple categories if the article applies to 2 more teams, eg. tournament info, game scores, etc.

    now, create a listing of all the teams(categories) and this becomes a reference to the “team” page, if you have other common categories you might want to create a parent/child category parent is “teams” and the child is “individual team name”

    you can do it by copying index.php, or if your theme has an existing category.php use that instead, and renaming it teams.php and flag it to list only categories from the team parent category
    see here http://codex.wordpress.org/Template_Hierarchy

    Then to duplicate, copy/paste the

    elseif – is_page (‘xx’) – cat = array(xx) line as many times as you need.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Pages with Posts’ is closed to new replies.