Adding Static Content to the Top of a Post Category Page

Discussion in 'WordPress' started by travoholic, Sep 29, 2010.

  1. #1
    Hi,

    I'm working on an accommodation section for a travel site and attempting to use Wordpress more as a CMS. I'm not sure whether to use posts or pages for my accommodation listings.

    The idea is this:

    Accommodation (main page/post category)
    --Country 1
    ----City 1
    ------Accommodation 1
    ------Accommodation 2
    ----City 2
    ------Accom 1
    ------etc
    --Country 2
    ----City 1
    ------Accommodation 1
    ------Accommodation 2
    ----City 2
    ------Accom 1
    ------etc

    I like that by using posts I can get lists of all of the accommodation very easily. But I also want to include a Google map at the top of the category listings. So for each city, I'd like a Google map at the top and for each country, probably something similar.

    Is it possible to add static content to the top of post category archives?

    Alternatively, is it possible to use pages and automatically display the sub pages in a list on the main page?

    Hope this makes sense... I know I'm confused! Any suggestions on the best way to organise this would be great!

    Thanks,
    Kirsty
     
    travoholic, Sep 29, 2010 IP
  2. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this is possible and pretty easy to do, when you edit a category it should show an id such as category&post_type=post&tag_ID=4, in this case the category id is 4, make a note of this.

    now copy the contents of (inside of the themes folder) archive.php and create a new file named category-id.php, in the above case it would be category-4.php, inside this file paste the code you copied from archive.php.

    Any edits that you make for category-4.php will show only when viewing category 4

    you can then do the same for each category, just create a new file for each category
     
    just-4-teens, Sep 29, 2010 IP
  3. travoholic

    travoholic Well-Known Member

    Messages:
    299
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #3
    I think that's exactly what I needed to know... how to make a template file for an individual category. I understand the concept... now to go make it work! Thanks so much for your help!
     
    travoholic, Sep 29, 2010 IP
  4. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #4
    just-4-teens, Sep 29, 2010 IP