Advertisement
srikat

front-page.php

Mar 28th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. <?php
  2. /**
  3. * This file adds the Home Page to the Enterprise Pro Theme.
  4. *
  5. * @author StudioPress
  6. * @package Enterprise Pro
  7. * @subpackage Customizations
  8. */
  9.  
  10. add_action( 'genesis_meta', 'enterprise_home_genesis_meta' );
  11. /**
  12. * Add widget support for homepage. If no widgets active, display the default loop.
  13. *
  14. */
  15. function enterprise_home_genesis_meta() {
  16.  
  17. if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-bottom' ) ) {
  18.  
  19. //* Force full-width-content layout setting
  20. add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
  21.  
  22. //* Add enterprise-pro-home body class
  23. add_filter( 'body_class', 'enterprise_body_class' );
  24.  
  25. add_action( 'genesis_after_header', 'genesis_header_markup_open' );
  26. add_action( 'genesis_after_header', 'genesis_do_header' );
  27. add_action( 'genesis_after_header', 'genesis_header_markup_close' );
  28.  
  29. //* Remove the default Genesis loop
  30. remove_action( 'genesis_loop', 'genesis_do_loop' );
  31.  
  32. //* Add home top widgets
  33. add_action( 'genesis_after_header', 'enterprise_home_top_widgets' );
  34.  
  35. //* Add home bottom widgets
  36. add_action( 'genesis_loop', 'enterprise_home_bottom_widgets' );
  37.  
  38. }
  39. }
  40.  
  41. function enterprise_body_class( $classes ) {
  42.  
  43. $classes[] = 'enterprise-pro-home';
  44. return $classes;
  45.  
  46. }
  47.  
  48. function enterprise_home_top_widgets() {
  49.  
  50. genesis_widget_area( 'home-top', array(
  51. 'before' => '<div class="home-top widget-area"><div class="wrap">',
  52. 'after' => '</div></div>',
  53. ) );
  54.  
  55. }
  56.  
  57. function enterprise_home_bottom_widgets() {
  58.  
  59. genesis_widget_area( 'home-bottom', array(
  60. 'before' => '<div class="home-bottom widget-area">',
  61. 'after' => '</div>',
  62. ) );
  63.  
  64. }
  65.  
  66. // Add custom Header + Hero wrapper's opening div tag
  67. add_action( 'genesis_before_header', 'sk_home_opening_div' );
  68. function sk_home_opening_div() {
  69. echo '<div class="home-hero">';
  70. }
  71.  
  72. // Add custom Header + Hero wrapper's closing div tag
  73. add_action( 'genesis_after_header', 'sk_home_closing_div' );
  74. function sk_home_closing_div() {
  75. genesis_widget_area( 'home-hero', array(
  76. 'before' => '<div id="home-hero-content"><div class="wrap">',
  77. 'after' => '</div></div>',
  78. ) );
  79.  
  80. echo '</div>';
  81. }
  82.  
  83. // Enqueue Scripts
  84. add_action( 'wp_enqueue_scripts', 'sk_enqueue_home_scripts_styles' );
  85. function sk_enqueue_home_scripts_styles() {
  86.  
  87. // Enqueue BigVideo on non-handhelds
  88. if ( ! wp_is_mobile() ) {
  89. wp_enqueue_script( 'video-js', get_stylesheet_directory_uri() . '/js/video.min.js', '', '5.0.2', true );
  90.  
  91. wp_enqueue_style( 'bigvideo-css', get_stylesheet_directory_uri() . '/css/bigvideo.css' );
  92. wp_enqueue_script( 'bigvideo', get_stylesheet_directory_uri() . '/js/bigvideo.js', array( 'video-js', 'jquery' ), '', true );
  93. }
  94.  
  95. wp_enqueue_script( 'froogaloop', 'https://raw.githubusercontent.com/vimeo/player-api/master/javascript/froogaloop.min.js', '', '', true );
  96.  
  97. if ( wp_is_mobile() ) {
  98. wp_enqueue_script( 'handhelds', get_stylesheet_directory_uri() . '/js/handhelds.js', array( 'jquery' ), '1.0.0', true );
  99. } else {
  100. wp_enqueue_script( 'bigvideo-init', get_stylesheet_directory_uri() . '/js/bigvideo-init.js', array( 'bigvideo' ), '1.0.0', true );
  101. }
  102. }
  103.  
  104. add_action( 'get_header', 'sk_video' );
  105. function sk_video() { ?>
  106. <div class="mask">&nbsp;</div>
  107.  
  108. <div class="popup-video">
  109. <iframe id="pPlayer" src="https://player.vimeo.com/video/43855469?title=0&amp;byline=0&amp;portrait=0&amp;api=1&amp;player_id=pPlayer" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
  110. </div>
  111. <?php }
  112.  
  113. // Remove Site Header on Posts page and Front page
  114.  
  115. remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
  116. remove_action( 'genesis_header', 'genesis_do_header' );
  117. remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
  118.  
  119. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement