Community Forums › Forums › Archived Forums › General Discussion › Two Style Sheets Being Called
Tagged: css, enqueue scripts, wp_enqueue_scripts
- This topic has 4 replies, 4 voices, and was last updated 6 years, 10 months ago by
SueCrawford.
-
AuthorPosts
-
May 16, 2016 at 5:11 am #185696
leighm
MemberHi,
I'm having a problem with my style sheet being called twice. I'm using the enterprise pro theme, and in the head of my template it's calling two versions of the same style sheet.
ver 2.1.1 and ver 4.5.2
They also have a different id for each one:
enterprise-pro-theme-css
enterprise-css<link rel="stylesheet" id="enterprise-pro-theme-css" href="http://localhost/smcu/wp-content/themes/enterprise-pro/style.css?ver=2.1.1" type="text/css" media="all"> <link rel="stylesheet" id="enterprise-css" href="http://localhost/smcu/wp-content/themes/enterprise-pro/style.css?ver=4.5.2" type="text/css" media="all">
Any idea of how and where from it's calling the second instance of the style sheet? I notice that it doesn't appear to be enqueued from the functions.php like it would be in a non genesis theme.
Here's the Enqueue Scripts.
//* Enqueue Scripts add_action( 'wp_enqueue_scripts', 'enterprise_load_scripts' ); function enterprise_load_scripts() { wp_enqueue_script( 'enterprise-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_script( 'enterprise-js', get_bloginfo( 'stylesheet_directory' ) . '/js/scripts.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Raleway:400,300,700,300italic', array(), CHILD_THEME_VERSION ); }
Thanks.
May 16, 2016 at 6:07 am #185697Victor Font
ModeratorChild theme style sheets are enqueued in the Genesis Framework, not in functions.php. The function that loads the child sheet is in /lib/css/load_style.php. If a child theme is active, it loads the child theme's style sheet, otherwise, it loads the Genesis style sheet. That particular function can only load 1 style sheet. It's not possible for it to load two. The 2.1.1 version is the correct version for Enterprise Pro.
I suspect that the old style sheet is hard coded somewhere and not being enqueued. Look in the Genesis Header Scripts or if you are using Genesis Simple Hooks, look there.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?May 16, 2016 at 6:32 am #185698leighm
MemberHi Victor,
Thanks for your reply. It's helped me isolate the source of the problem. I added functionality to allow my client to enter their own featured background image on the homepage. They can do this by going to Appearances > Customize.
To do this I had to create two files in the lib folder, one of them being output.php. There's a function in that file that included this line:
wp_enqueue_style( 'enterprise', get_stylesheet_directory_uri() . '/style.css' );
I removed this line and it removed the reference to the 2nd instance of the style.css file.
Thanks.
May 19, 2016 at 1:13 am #185881phamtuanh
MemberMarch 21, 2018 at 8:57 pm #218227SueCrawford
ParticipantI think I am having the same problem with two stylesheet versions. They are named:
...themes/enterprise-pro/style.css?ver=1.0
...themes/enterprise-pro/style.css?ver=2.1.1This was identified through a scan done by GTmetrix. We are trying to figure out why the site is so slow and we keep having random problems.
I'm afraid I'm not savvy enough to understand the thread where this was discussed earlier. Could someone explain simply how I remedy this?
Thanks for any help...
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.