chrisyakimov
Forum Replies Created
-
Forum: Plugins
In reply to: [Promotion Slider] More than one category in promotion-slider?No bad at all – I was also really tired last night so I hope I didn’t come across as unappreciative! The slider is awesome, and our clients really like it as a primary feature on their site (not live just yet).
My main desires would be:
a) Being able to access an array of values passed from the shortcode in my theme’s functions.php file in order to affect the custom query for use with a filter. (maybe it’s already possible to do this?)
b) Being able to apply multiple taxonomies (or have the default Category or Tag taxonomies apply to the promotion content type).
Again thanks, Woodent!
🙂Forum: Plugins
In reply to: [Promotion Slider] More than one category in promotion-slider?Alright – so too many hours later, I think I’m pretty sure that the plugin isn’t coded to handle this via that hook.
I don’t know how to access the paramaters pulled by the shortcode when I’m using a hook to affect query.
So I *first time for everything* hacked the plugin core index.php
1. changed the default post type to ‘any’ (around line 250 and the validator a few lines later) since get_posts() will show all post types (this allows you to control the slider by category if promotions used the same taxonomy as all other content. But alas, they don’t. So..
2. disabled the custom taxonomy for the promotion post type (line 64 – just commented it out), then changed the “if/else if” code (around line 270) which set $query[‘category_name’] and/or $query[$this->taxonomy] so that it instead only set $query[‘category_name’]=$category
This way, whatever post type I specify, so long as that post-type is registered with wordpress’ native category structure, I’ll be able to use that to control what goes in the slider via the shortcode.
But, “promotions” are not registered with the “Category” default tax, so:
3. Added a line to the function ‘post_type_args’ (line 80) that would tell wordpress to register the promotion post-type with the default Category taxonomy
function post_type_args( $args ){
$args['supports'] = array('title', 'editor', 'thumbnail');
/*cy hack - added to override custom taxonomy so that we could cross post-types with the shortcode*/
$args['taxonomies'] = array('category');
//end hack
return $args;
}Hope I’ve explained myself (this is as deep as I’ve gotten into a wordpress addon).
With these hacks, I can assign Promotions to normal wordpress categories. I can create a category called “promo”, and tag any posts or promotions I want to display in the viewer. I just use category=”promo” in the viewer shortcode.
We never display categories as nav, so this works. And default viewer is now open to display any (every) piece of content, allowing filtration. If you want to go back to just “promotions” just use type=”promotion”
If someone has a way that I could have done all this via filters and hooks, I’d be very happy to learn (really don’t like to have hacked a plugin file directly).
c
Forum: Plugins
In reply to: [Promotion Slider] More than one category in promotion-slider?Awesome woodent – thanks for the pointer. I’ll post how it goes. Cheers!
🙂