Site logo

Archived topic

Enqueue styles

6 replies · Started by Bradley on January 4, 2017

Viewing posts 1–7 of 7

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

My goal is simply to get the products to look like this

You 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 );

This 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

Thanks Tom.

No problem :)

This archived topic is closed to new replies.