• Resolved hughc

    (@hughc)


    Including a full Foundation css that includes global definitions for a bunch of stuff that is well outside the scope of the plugin’s rendered content seems like overkill.

    I’m using a Bootstrap based theme, and it affected (read: broke) layouts on pages outside the /listings or individual listing pages. It also strips out body fonts.

    Suggest that you use a css preprocessor like less or scss to scope all this loaded css to just the pages and elements it needs to be applied to. Just loading a Foundation base sheet seems like a recipe for disaster, as it is bound to have much wider implications than just the page(s) it targets.

    https://wordpress.org/plugins/simple-directory/

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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' );
      }

    Plugin Author michaellautman

    (@michaellautman)

    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.

    Plugin Author michaellautman

    (@michaellautman)

    Upgrade to 1.4.0.

    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.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Foundation CSS’ is closed to new replies.