Advertisement
imranmodel32

treehouse bootstrap to wp

Jun 5th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. //wp-bootstrap-navwalker
  2. https://github.com/twittem/wp-bootstrap-navwalker
  3.  
  4. // reset when multiple loop needed
  5. <?php rewind_posts(); ?>
  6.  
  7. // conditional call back sidebar
  8. <?php if ( ! dynamic_sidebar( 'sibebar-name' ) ): ?>
  9.  
  10. // conditional page query
  11. <?php if ( have_post() ) : while ( have_post() ) : the_post(); ?>
  12.  
  13. <!-- page title -->
  14. <div class="page-header">
  15. <h1><?php the_title();?></h1>
  16. </div>
  17.  
  18. <?php the_content();?>
  19.  
  20. <!-- conditiona -->
  21. <?php endwhile; else: ?>
  22.  
  23. <div class="page-header">
  24. <h1>Opps!</h1>
  25. </div>
  26.  
  27. <p>No content is appearing for this page!</p>
  28.  
  29. <?php endif;?>
  30.  
  31. <!-- add style -->
  32. <?php
  33. function theme_styles(){
  34.  
  35. wp_enqueue_style( 'name_of_file', get_template_directory_uri(). 'css/bootstrap.css' );
  36. wp_enqueue_style( 'another_name_of_file', get_template_directory_uri(). 'css/style.css' );
  37.  
  38. }
  39. add_action('wp_enqueue_script','theme_styles');
  40.  
  41. ?>
  42.  
  43. <!-- conditional js for older IE -->
  44. <!-- load js properly -->
  45.  
  46. <?php
  47.  
  48. function theme_js(){
  49.  
  50. global $wp_scripts;
  51.  
  52. wp_register_script('html5_shivshiv','https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js','','',false);
  53. wp_register_script('respond_js','https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js','','',false);
  54.  
  55. $wp_scripts->add_data( 'html5_shivshiv', 'conditional', 'lt IE 9' );
  56. $wp_scripts->add_data( 'respond_js', 'conditional', 'lt IE 9' );
  57.  
  58. wp_enqueue_script('bootstrap_js',get_template_directory_uri().'js/bootstrap.js',array('jquery'),'',true);
  59.  
  60. }
  61. add_action('wp_enqueue_script','theme_js');
  62.  
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement