Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

WordPress

cleo inacio
cleo inacio
169 Points

PHP styles and scripts not showing - console says 'unexpected token' js files. FIXED.

-----------Functions.php---------------


<?php

       function bmethod_theme_styles() {

             wp_enqueue_style('normalize_css' , get_template_directory_uri() . '/css/normalize.css');
             wp_enqueue_style('materialize_css' , get_template_directory_uri() . '/css/materialize.css');
             wp_enqueue_style('ionicons_css' , get_template_directory_uri() . '/css/ionicons.min.css');
             wp_enqueue_style('fontawesome_css' , get_template_directory_uri() . '/css/font-awesome.min.css');
             wp_enqueue_style('component_css' , get_template_directory_uri() . '/css/component.css');
             wp_enqueue_style('bootstrapmin_css' , get_template_directory_uri() . '/css/bootstrap.min.css');
             wp_enqueue_style('animate_css' , get_template_directory_uri() . '/css/animate.min.css');
             wp_enqueue_style('bootstrap_css' , get_template_directory_uri() . '/css/bootstrap.css');
             wp_enqueue_style('bootstrap_css' , 'https://fonts.googleapis.com/css?family=Lato:400,100,200');
             wp_enqueue_style('main_css' , get_template_directory_uri() . '/style.css');
       }
       add_action('wp_enqueue_styles', 'wp_enqueue_scripts');


       function bmethod_theme_js() {
          wp_enqueue_script('modernizr_js', get_template_directory_uri().'js/modernizr.custom.js','','',false);
          wp_enqueue_script('nlform_js', get_template_directory_uri().'js/nlform.js',array('jquery'),'',true);
          wp_enqueue_script('main_js', get_template_directory_uri().'js/custom.js',array('jquery'),'',true);
          wp_enqueue_script('materialize_js', get_template_directory_uri().'js/materialize.js',array('jquery'),'',true);
          wp_enqueue_script('bootstrap_js', get_template_directory_uri().'js/bootstrap.min.js',array('jquery'),'',true);
       }
       add_action('wp_enqueue_scripts', 'bmethod_theme_js');

?>

--------------header.php-----------

    <title><?php bloginfo('name');?> | <?php is_front_page() ? bloginfo('Description') : wp_title(); ?> </title>
    <meta name="description" content="<?php bloginfo('Description'); ?>">
    <meta charset="<?php bloginfo('charset');?>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />


<?php wp_head(); ?>
<head>
<body>
  <section>
        <div class="brand">
          <a href="index.html"><img src="<?php bloginfo('template_url'); ?>/images/bmlogo.png"></a>
        </div>

        <ul id="nav-menu">

          <li id="navli"><a href="index.html"><span id="nava">Hire BM</span></a></li>
          <li id="navli"><a href="index.html"><span id="nava">BM.Store</span></a></li>
        </ul>
</section>
</head>


-----------Footer.php--------------

<footer>
       <div class="main clearfix">
                        <form id="nl-form" class="nl-form">
                            <div id="contactus">Contact us!</div>
                            I would like to
                            <select>
                                <option value="1" selected>chat about a project.</option>
                                <option value="2">know more about BM.</option>
                                <option value="3">ask about a job.</option>
                                <option value="4">say hi!</option>
                                <option value="2">create stuff together.</option>
                            </select>
                            <br />
                            My name is
                          <input type="text" value="" placeholder="your name" data-subline="For example: <em>John</em> or <em>sally</em>"/>
                            and my email is
                          <input type="text" value="" placeholder="your email" data-subline="For example: <em>john@gmail.com</em> or <em>info@sally.com</em>"/>
                            .<div class="nl-submit-wrap">
                                <button class="nl-submit" type="submit" onSubmit="alert('Thanks!');">Send</button>
                            </div>
                            <div class="nl-overlay"></div>
                        </form>
                    </div>



                    <div class="containerfooter">
                            <div class="row">

                                <div class="col-md-12 col-sm-12">
                                    <p class="wow fadeInUp foot"  data-wow-delay="0.3s">Copyright © <?php echo Date('Y');?> Brood Method. - To Think Deeply - braedon.millar29@gmail.com</p>
                                    <ul class="social-icon wow fadeInUp"  data-wow-delay="0.6s">
                                        <li><a href="#" class="fa fa-facebook"></a></li>
                                        <li><a href="#" class="fa fa-twitter"></a></li>
                                        <li><a href="#" class="fa fa-dribbble"></a></li>
                                        <li><a href="#" class="fa fa-behance"></a></li>
                                        <li><a href="#" class="fa fa-google-plus"></a></li>
                                    </ul>
                                </div>

                            </div>
                        </div>



</footer>
<?php wp_footer(); ?>
</body>
</html>


-------------------STYLES FIXED-------------
This fixed my styles----but scripts still not working 


function bmethod_theme_styles() {

         wp_register_style( 'normalize_css', get_template_directory_uri() . '/css/normalize.css', array(), '1', 'all' );
             wp_enqueue_style( 'normalize_css' );
             //wp_enqueue_style('normalize_css' , get_template_directory_uri() . '/css/normalize.css');

         wp_register_style( 'materialize_css', get_template_directory_uri() . '/css/materialize.css', array(), '1', 'all' );
             wp_enqueue_style( 'materialize_css' );
             //wp_enqueue_style('materialize_css' , get_template_directory_uri() . '/css/materialize.css');

         wp_register_style( 'fontawesome_css', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '1', 'all' );
             wp_enqueue_style( 'fontawesome_css' );
             //wp_enqueue_style('fontawesome_css' , get_template_directory_uri() . '/css/font-awesome.min.css');

         wp_register_style( 'ionicons_css', get_template_directory_uri() . '/css/ionicons.min.css', array(), '1', 'all' );
             wp_enqueue_style( 'ionicons_css' );
             //wp_enqueue_style('ionicons_css' , get_template_directory_uri() . '/css/ionicons.min.css');

         wp_register_style( 'component_css', get_template_directory_uri() . '/css/component.css', array(), '1', 'all' );
            wp_enqueue_style( 'component_css' );
             //wp_enqueue_style('component_css' , get_template_directory_uri() . '/css/component.css');

         wp_register_style( 'bootstrapmin_css', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '1', 'all' );
           wp_enqueue_style( 'bootstrapmin_css' );
             //wp_enqueue_style('bootstrapmin_css' , get_template_directory_uri() . '/css/bootstrap.min.css');

         wp_register_style( 'animate_css', get_template_directory_uri() . '/css/animate.min.css', array(), '1', 'all' );
           wp_enqueue_style('animate_css' );
             //wp_enqueue_style('animate_css' , get_template_directory_uri() . '/css/animate.min.css');

         wp_register_style('bootstrap_css' , get_template_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' );
           wp_enqueue_style('bootstrap_css' );
             //wp_enqueue_style('bootstrap_css' , get_template_directory_uri() . '/css/bootstrap.css');

         wp_register_style('lato_font' , 'https://fonts.googleapis.com/css?family=Lato:400,100,200', array(), '1', 'all' );
           wp_enqueue_style('lato_font' );
             //wp_enqueue_style('lato_font' , 'https://fonts.googleapis.com/css?family=Lato:400,100,200');

         wp_register_style('main_css' , get_template_directory_uri() . '/style.css', array(), '1', 'all' );
          wp_enqueue_style('main_css' );
           //wp_enqueue_style('main_css' , get_template_directory_uri() . '/style.css');
       }

       add_action('wp_enqueue_scripts', 'bmethod_theme_styles');


------------------------FUNCTIONS FIXED - left out the '/' -------------------

function bmethod_theme_js() {


        wp_register_script( 'modernizr_js' , get_template_directory_uri() . '/js/modernizr.custom.js' , '' , '' , false );
         wp_enqueue_script( 'modernizr_js' );
         //wp_enqueue_script('modernizr_js', get_template_directory_uri().'js/modernizr.custom.js','','',false);

        wp_register_script( 'nlform_js', get_template_directory_uri() . '/js/nlform.js', array( 'jquery' ) );
         wp_enqueue_script( 'nlform_js' );
         //wp_enqueue_script('nlform_js', get_template_directory_uri().'js/nlform.js',array('jquery'),'',true);

        wp_register_script( 'main_js', get_template_directory_uri() . '/js/custom.js', array( 'jquery' ) );
         wp_enqueue_script( 'main_js' );
          //wp_enqueue_script('main_js', get_template_directory_uri().'js/custom.js',array('jquery'),'',true);

        wp_register_script( 'materialize_js', get_template_directory_uri() . '/js/materialize.js', array( 'jquery' ) );
          wp_enqueue_script( 'materialize_js' );
          //wp_enqueue_script('materialize_js', get_template_directory_uri().'js/materialize.js',array('jquery'),'',true);

        wp_register_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ) );
            wp_enqueue_script( 'bootstrap_js' );
          //wp_enqueue_script('bootstrap_js', get_template_directory_uri().'js/bootstrap.min.js',array('jquery'),'',true);

       }
       add_action('wp_enqueue_scripts', 'bmethod_theme_js');




          ```