Menu icon Foundation
Messes up layout in WordPress admin

Hi,
I'm new to using Foundation, and I created a custom WordPress theme using Foundation but it's messing up the WordPress admin. I asked around on the WP forums and someone said I need to enqueue the scripts in the functions.php file but I'm not clear on how to do this with Foundation, and not sure if it will resolve the issue so I'm hoping someone here can help.

This is the link they lead me to about the enqueue script code: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

If anyone knows how to use Foundation in WordPress, please let me know how you got it to work without breaking the WordPress admin.

Thanks! Happy Holidays!

wordpressadminlayout

Hi,
I'm new to using Foundation, and I created a custom WordPress theme using Foundation but it's messing up the WordPress admin. I asked around on the WP forums and someone said I need to enqueue the scripts in the functions.php file but I'm not clear on how to do this with Foundation, and not sure if it will resolve the issue so I'm hoping someone here can help.

This is the link they lead me to about the enqueue script code: http://codex.wordpress.org/Function_Reference/wp_enqueue_script

If anyone knows how to use Foundation in WordPress, please let me know how you got it to work without breaking the WordPress admin.

Thanks! Happy Holidays!

Karl Ward over 5 years ago

I am not sure why Foundation is messing up your Wordpress admin, because it is not even used in your Wordpress admin. Your Wordpress admin is 100% separate from Foundation, at least it should be, and if its not, then I wonder why it has been added ...

Jade over 5 years ago

I know, I've never had this issue before, although I have seen free themes cause admin issues. I tried to enqueue the scripts instead, by adding them to the functions.php file, but it just broke the entire frontend layout and did nothing to resolve the admin layout issues.

This is the code I tried in the functions.php file. I borrowed it from something I found through the forums here called Joint Foundation.:

// loading modernizr and jquery, and reply script
function ywn_scripts_and_styles() {
  global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way
  if (!is_admin()) {

    // modernizr (without media query polyfill)
    wp_register_script( 'ywn-modernizr', get_stylesheet_directory_uri() . '/js/vendor/custom.modernizr.js', '','','all' );

    // adding Foundation scripts file in the footer
    wp_register_script( 'foundation-js', get_template_directory_uri() . '/js/foundation.min.js', '','','all' );

    // register main stylesheet
    wp_register_style( 'ywn-stylesheet', get_stylesheet_directory_uri() . '/style.css', array(), '', 'all' );

    // register foundation
    wp_register_style( 'foundation', get_stylesheet_directory_uri() . '/css/foundation.css', array(), '', 'all' );


    // enqueue styles and scripts
    wp_enqueue_script( 'ywn-modernizr' );
    wp_enqueue_script ('foundation-js');
    wp_enqueue_style( 'ywn-stylesheet' );
    wp_enqueue_style( 'foundation' );

  }
}

Karl Ward over 5 years ago

Sorry, Wordpress+PHP combo is a bit outside my area of knowledge. I still don't understand why your WP admin is trying to load anything at all from Foundation. I can only imagine you are using a very specific theme (ywn?) with special theme settings that is trying to do something? It shouldnt be like this ... your theme might not work for any amount of reasons, but your WP admin should not be affected by themes at all ...

It would help to know how exactly its "messing up the admin" ...

Jade over 5 years ago

No, I design custom themes, I don't use third party themes at all. And it's very bare bones, nothing fancy going on, no custom admin stuff or anything. I have a different slideshow installed, that's about it LOL! I've never had this issue before with any of my themes because I always try to keep them very light (no javascript, etc. called from within the theme at all) but in this case, I'm outside my area of expertise because I've got all these javascript files and I'm sure that has something to do with it.

Thanks anyway for responding, maybe someone from Foundation's team can help?? Please??

Jade over 5 years ago

I figured this one out. Apparently using .button was conflicting with core WP styles, so when I renamed that particular style, everything was back to normal.