Thread Starter
hughc
(@hughc)
ok, so i found the option to disable it, all good. But removing the sheet doesn’t remove the conflicted classes off elements, so I’m still left to override your templates to get things to display cleanly. Suggest that you do a woo-commerce-esque check for overridden templates before using the included ones, ie:
add_filter( 'template_include', 'simple_dir_load_templates' );
function simple_dir_load_templates( $template )
{
if ( 'listing' === get_post_type() && is_single() ) {
$overrideTemplate = get_stylesheet_directory() . '/simple-directory/single-listing.php';
if (file_exists($overrideTemplate)) {
return $overrideTemplate;
} else {
return dirname( __FILE__ ) . '/templates/single-listing.php';
}
}
if ( 'listing' === get_post_type() && is_archive()){
$overrideTemplate = get_stylesheet_directory() . '/simple-directory/archive-listing.php';
if (file_exists($overrideTemplate)) {
return $overrideTemplate;
} else {
return dirname(__FILE__) . '/templates/archive-listing.php';
}
}
return $template;
}
That’s a bit rough (only checks child dir) but you get the idea.
Thread Starter
hughc
(@hughc)
Just realised that although you have an admin option for disabling Foundation, it doesn’t seem to do anything.
When enqueuing styles:
$use_foundation = $directory_settings['simple_directory_disable_foundation'] == 'no';
if ($use_foundation) {
wp_register_style( 'simple-directory-foundation', plugins_url('simple-directory/css/foundation.css', dirname(__FILE__)), false, false );
wp_enqueue_style( 'simple-directory-foundation' );
}
Hugh,
Thanks for the attentive feedback. I will ensure that the admin option works on the next update, which will roll out tonight or tomorrow. I will start looking at how much of foundation is loaded. Having alternative templates, such as one built on Bootstrap is part of the Pro development roadmap.
Thanks again.
Thread Starter
hughc
(@hughc)
Thanks for the update, but simply disabling Foundation didn’t fix things for me, as the class names on elements were still in conflict with the base style names I’m using… for example a ‘row’ is a different thing in Bootstrap vs Foundation.
If you could create a foundation stylesheet that defined its rules scoped to just the elements that you wanted, that might be useful (ie predicated with some selectors that target just the elements you are drawing):
in less / sass terms:
body.post-type-archive-listing, body.single-listing {
// foundation styles go here
}
Alternatively, use foundation classes as mixins and use custom style names, namespaced to your plugin, ie
sd-row, sd-medium-3 etc
http://foundation.zurb.com/docs/using-sass.html
This would target your CSS and provide certainty in terms of how things render; it would also negate the need for users to disable the Foundation sheet.