[Resolved] Enqueue styles

Home Forums Support [Resolved] Enqueue styles

Home Forums Support Enqueue styles

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #260519
    Bradley

    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

    #260520
    Bradley

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

    #260618
    Tom
    Lead Developer
    Lead Developer

    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 );
    #260705
    Bradley

    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

    #260764
    Tom
    Lead Developer
    Lead Developer

    Exactly, 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.

    #260789
    Bradley

    Thanks Tom.

    #260801
    Tom
    Lead Developer
    Lead Developer
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.