I have a Structure-based site with category listing pages. For example: http://www.mysite.com/products/category/tools/hammers. Naturally, I’m using Zoo Triggers to output the entry listing.
My problem is that each category listing page needs unique SEO meta data, so I set up custom fields for Title, Keywords, and Description. Unfortunately, Zoo Triggers doesn’t have variables for custom category fields, and the {exp:channel:category_heading} tag won’t work on Zoo Triggers URLs.
I thought I could use the magical GWCode Categories plugin, but I can’t figure out how to display data for the current category only.
Does anyone have any suggestions on how I can make this happen? Thanks.
This probably calls for a custom query. As EE stores its core and custom category data in separate tables this is a bit unwieldy for the native query module, so I’d be inclined to use Rob Sanchez’s ActiveRecord plugin. I haven’t tested this extensively but the following snippet should be in the ballpark:
If you’re not particularly familiar with CodeIgniter’s Active Record class, this is doing the following:
field_id_1, and creating aliases for use within your template, e.g.{seo_field_one}.categoriesandcategory_field_datatables so that we can retrieve data in the field_data table based on values in the categories table.In order to implement this in your template you’d need to adjust the select statement so that it’s retrieving data from the right columns and tweak the
group_idto match up with your category group. I’m assuming that you want to retrieve data for the last URL segment but you can easily adjust that too if need be.