Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress From Bootstrap to WordPress Setup a Bootstrap Theme Creating Bootstrap Navigation in WordPress

Cesare Parmiggiani
Cesare Parmiggiani
8,017 Points

How to add other js

I'm using a wysiwig instrument called BLOCS.

It generate web pages with bootstrap, so i tried to convert my html into a wordpress theme.

I think i've got a problem with functions.

In css I got:

  • bootstrap.css
  • font-awesome.min.css

In js I got:

  • blocs.js
  • bootstrap.js
  • jquery-2.1.0.min.js

I wrote my function.js this way.....

<?php

function theme_styles() {

wp_enqueue_style('bootstrap_css', get_template_directory_uri() . '/css/bootstrap.css');

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

function theme_js() {

global $wp_scripts;

wp_register_script( 'html5_shiv', 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js', '', '', false );
wp_register_script( 'respond_js', 'https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js', '', '', false );

$wp_scripts->add_data( 'html5_shiv', 'conditional', 'lt IE 9' );
$wp_scripts->add_data( 'respond_js', 'conditional', 'lt IE 9' );

wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '', true );
wp_enqueue_script( 'blocs_js', get_template_directory_uri() . '/js/blocs.js', array('jquery'), '', true );
wp_enqueue_script( 'jquery_s', get_template_directory_uri() . 'jquery-2.1.0.min.js', array('jquery'), '', true );

}

?>