- This topic has 6 replies, 2 voices, and was last updated 7 years, 3 months ago by Tom.
-
AuthorPosts
-
January 4, 2017 at 3:58 am #260519Bradley
I am trying to install a custom “material design for bootstrap” css file that I like into a child theme that is a customized “statement” child theme for use with marketpress ecommerce and when I try and Enqueue it with functions.php in the child theme it breaks. Here is the code I am trying to use to inject it. …
?php /** * Include CSS files */ function theme_enqueue_scripts() { wp_enqueue_style( 'Font_Awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' ); wp_enqueue_style( 'Bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' ); wp_enqueue_style( 'MDB', get_template_directory_uri() . '/css/mdb.min.css' ); wp_enqueue_style( 'Style', get_template_directory_uri() . '/style.css' ); wp_enqueue_script( 'jQuery', get_template_directory_uri() . '/js/jquery-2.2.3.min.js', array(), '2.2.3', true ); wp_enqueue_script( 'Tether', get_template_directory_uri() . '/js/tether.min.js', array(), '1.0.0', true ); wp_enqueue_script( 'Bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '1.0.0', true ); wp_enqueue_script( 'MDB', get_template_directory_uri() . '/js/mdb.min.js', array(), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_scripts' ); ?>
I get “enexpected
Any help would be appreciated .
Brad
January 4, 2017 at 4:00 am #260520BradleyMy goal is simply to get the products to look like this
January 4, 2017 at 9:17 am #260618TomLead DeveloperLead DeveloperYou should use https://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri in place of get_template_directory_uri() if you’re using a child theme.
Also, remove these two lines:
wp_enqueue_style( 'Style', get_template_directory_uri() . '/style.css' ); wp_enqueue_script( 'jQuery', get_template_directory_uri() . '/js/jquery-2.2.3.min.js', array(), '2.2.3', true );
January 4, 2017 at 12:16 pm #260705BradleyThis would allow me to add to the existing css structure of the theme by adding the directory for that supporting css I want to use? It’s just like adding bootstrap to a theme. I am just wanting to add a custom bootstrap set up.
B
January 4, 2017 at 4:31 pm #260764TomLead DeveloperLead DeveloperExactly, you would upload your child theme (https://docs.generatepress.com/article/using-child-theme/), and then add that function (minus the scripts I said) to your functions.php file.
Then you would upload those scripts/styles to your child theme folder.
January 4, 2017 at 9:42 pm #260789BradleyThanks Tom.
January 4, 2017 at 9:56 pm #260801TomLead DeveloperLead DeveloperNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.