Forum Replies Created
-
AuthorPosts
-
September 14, 2014 at 5:54 am in reply to: template_redirect and switching templates dynamically #124317marcusMember
We'd be happy to do it when time permits, not entirely yet sure whether to include it in the plugin, there are pros/cons but might make sense to do so.
Thanks for the pointers!
September 14, 2014 at 4:33 am in reply to: template_redirect and switching templates dynamically #124305marcusMemberOK, an update.... this isn't possible the way I'd like to do it.
What we're doing for normal themes is feeding the theme with the template file (even page.php) that has to be loaded and that file usually contains the HTML that is output.
Genesis does it differently, calling the Genesis functions which then build the page according to WP_Query functions like is_single() which CPTs will always trigger as true.
The only way to do this (and this is how Genesis WooCommere Connect does it) is load custom templates that fire/unload the right Genesis hooks to produce the right structure of page.
So.... we'll need to warn users using Genesis that this function won't work as expected and that templates are needed. Maybe another plugin like GWC will be made in the future for Events Manager
September 12, 2014 at 1:54 am in reply to: template_redirect and switching templates dynamically #124078marcusMemberThanks for the tip, but need to point out that this is somewhat off topic (esp for anyone else wanting to contribute here)... the checking of Genesis is fairly straightforward, my main concern is the switching of templates which is the part I'm having difficulties with.
The Connect plugin was really helpful though, assuming it works I'll test it out and figure out why the same sort of snippet doesn't work for me.
September 11, 2014 at 1:23 pm in reply to: template_redirect and switching templates dynamically #124004marcusMemberIf you look at the way Genesis checks for SEO plugins in genesis > lib > functions > seo.php you’ll see how its done.
For this I assmue you're referring to checking if Genesis is active? I guess checking for a core function may be even better...
Thanks for the Connect plugin reference, that's very handy. I had a go at copying what they do but it doesn't take (the hooks are fired and the right templates are passed on). I'll set up WC and this plugin to see it in action and will investigate further asap, if anyone has any suggestions meantime, much appreciated!
add_action( 'after_setup_theme', 'em_genesis_single_template' ); function em_genesis_single_template(){ if( get_option('dbem_cp_events_template') ){ //override default template add_filter('template_include',array('EM_Event_Post','single_template'), 20); //function to do the overriding } }
September 10, 2014 at 11:17 am in reply to: template_redirect and switching templates dynamically #123769marcusMemberThanks for the reply. I could do that, I see there's some constants I could check for like PARENT_THEME_NAME == 'Genesis' (is that a good way?)
The problem still remains that I don't know how to switch template files the genesis way even if I know Genesis is being used.
-
AuthorPosts