Support » Fixing WordPress » One template for multiple content types

  • Resolved colind

    (@colind)


    I have 3 content types, ‘press_release’, ‘media_coverage’, and ‘events’ that all need their own page to list all the items of their type but are displayed in the same format. Is there a way to make a single template and somehow pass it the content type to use in the query_posts() statement? Or is it easiest to make 3 templates that do query_posts and then call a common get_template_part()?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You could use a custom field to contain the content type. Create a single template that retrieves the custom field and issues the proper query. Create 3 Pages with the correct custom field value and assign the template to them.

    Thread Starter colind

    (@colind)

    What a cool solution! Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘One template for multiple content types’ is closed to new replies.