• I am building a website which includes pages on each country of the world, with 5-6 posts about topics such as geography, background history etc on each, plus links to sub-pages.

    I would like a single ‘country main page’ template that recognises what country the page is and calls the appropriate posts.

    if country-geography is posts category 9

    cat_ID=9 and tag=malta, or tag=geography+malta should find the post required. I can put malta in a custom field on the page, but how can the php template convert the custom field variable into a category or tag to retrieve posts?

    Thanks for any help!

    John

Viewing 4 replies - 1 through 4 (of 4 total)
  • The Page of Posts example in the Pages article would be the place to start…you’d need to expand the logic to support your tags.

    Check out the docs on Page Templates. There’s an example posted about how to use a page template to make a page that displays the posts within a given category. It may be fairly simple to adapt to make it display by tag, but you may already have the content assigned to categories.

    http://codex.wordpress.org/Pages#A_Page_of_Posts

    I have used this example and it works.

    Thread Starter aeroflight

    (@aeroflight)

    Er yes, that would work, but would require me to include about 200 $cat= statements in the template to allow for one for each country.

    Is there a way of doing it semi-automatically, or with less typing at any rate?

    Use the country names as category names and set the category list to be a drop-down like on this site:

    http://oldcarnetwork.com/

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘getting many subject pages to talk to same template’ is closed to new replies.