come installare bootstrap nel tema twentyfourteen
2 ott 2014, 05:35:05
Visualizzazioni: 15.1K
Voti: 2
Sono nuovo nell'uso di WordPress e mi chiedo se sia possibile installare Bootstrap nel mio tema TwentyFourteen? Grazie!

user3754764
25
Tutte le risposte alla domanda
1
2
Il modo migliore per includere Bootstrap nel tuo tema è accodare i file CSS e JS di Bootstrap nel file functions.php.
Ecco come puoi accodare i file CSS e JS di Bootstrap dalla versione ospitata su CDN.
function my_scripts_enqueue() {
wp_register_script( 'bootstrap-js', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js', array('jquery'), NULL, true );
wp_register_style( 'bootstrap-css', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css', false, NULL, 'all' );
wp_enqueue_script( 'bootstrap-js' );
wp_enqueue_style( 'bootstrap-css' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts_enqueue' );
Se non vuoi utilizzare la versione ospitata su CDN, scarica i file di Bootstrap e inseriscili nel tuo tema, poi includili in questo modo.
function my_scripts_enqueue() {
wp_register_script( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), NULL, true );
wp_register_style( 'bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css', false, NULL, 'all' );
wp_enqueue_script( 'bootstrap-js' );
wp_enqueue_style( 'bootstrap-css' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts_enqueue' );

Robert hue
8.56K
2 ott 2014 06:33:13
Commenti
grazie Robert. Devo ancora includere i file bootstrap nella mia cartella di WordPress?

2 ott 2014 06:36:57
Domande correlate
1
risposte