Advertisement:

Author Topic: Different template for certain categories  (Read 974 times)

leemchildress

  • Newbie
  • *
  • Posts: 11
Different template for certain categories
« on: January 02, 2014, 03:10:53 pm »
Is it possible to select a different template based on category?

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: Different template for certain categories
« Reply #1 on: January 02, 2014, 03:53:12 pm »
@leemchildress
It is interesting idea, but till now noone has posted solution for this.
There is already demo plugin that can be downloaded from osclass market and allows user to change theme, maybe you can use this functionality to change template for every category.

leemchildress

  • Newbie
  • *
  • Posts: 11
[solved] Re: Different template for certain categories
« Reply #2 on: January 03, 2014, 05:29:04 pm »
I have resolved this issue by taking the item.php file and placing the body of the page in conditional statements. Example, if category_parent_id = (jobs id) then use the following template, OR if category_parent_id = (real estate id) then use this template, ELSE use the following generic template.

Example:

...
if (osc_category_parent_id() == 6) { // Job Parent Category ID

Job Template

} elseif (osc_category_parent_id() == 3 { // Real Estate Parent Category ID

Real Estate Template

} else { // Default template

Default Template

}

Yes, this means hacking away at the theme code, but my theme has been heavily modified already. No upgrading for me.

frosticek

  • Hero Member
  • *****
  • Posts: 3948
Re: Different template for certain categories
« Reply #3 on: January 03, 2014, 05:36:28 pm »
@leemchildress
Yes, this is also way how to go :)