Advertisement
Guest User

Untitled

a guest
Aug 8th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. <?php
  2.  
  3. //* Enqueue scripts
  4. add_action( 'wp_enqueue_scripts', 'minimum_front_page_enqueue_scripts' );
  5. function minimum_front_page_enqueue_scripts() {
  6.  
  7. //* Load scripts only if custom background is being used
  8. if ( ! get_background_image() )
  9. return;
  10.  
  11. //* Enqueue Backstretch scripts
  12. wp_enqueue_script( 'minimum-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
  13. wp_enqueue_script( 'minimum-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'minimum-backstretch' ), '1.0.0' );
  14.  
  15. wp_localize_script( 'minimum-backstretch-set', 'BackStretchImg', array( 'src' => str_replace( 'http:', '', get_background_image() ) ) );
  16.  
  17. //* Add custom body class
  18. add_filter( 'body_class', 'minimum_add_body_class' );
  19.  
  20. }
  21.  
  22. //* Minimum custom body class
  23. function minimum_add_body_class( $classes ) {
  24. $classes[] = 'minimum';
  25. return $classes;
  26. }
  27.  
  28. //* Add widget support for homepage if widgets are being used
  29. add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
  30. function minimum_front_page_genesis_meta() {
  31.  
  32. if ( is_home() ) {
  33.  
  34. //* Remove entry meta in entry footer and Genesis loop
  35. remove_action( 'genesis_loop', 'genesis_do_loop' );
  36.  
  37. //* Add Genesis grid loop
  38. add_action( 'genesis_loop', 'minimum_grid_loop_helper' );
  39.  
  40. //* Remove entry footer functions
  41. remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
  42. remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
  43. remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
  44.  
  45. //* Force full width content layout
  46. add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
  47.  
  48. }
  49.  
  50. if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) || is_active_sidebar( 'home-featured-4' ) ) {
  51.  
  52. //* Add Home featured Widget areas
  53. add_action( 'genesis_before_content_sidebar_wrap', 'minimum_home_featured', 15 );
  54.  
  55. }
  56.  
  57. if ( is_active_sidebar( 'home-bottom-1' ) || is_active_sidebar( 'home-bottom-2' ) || is_active_sidebar( 'home-bottom-3' ) || is_active_sidebar( 'home-bottom-4' ) ) {
  58.  
  59. //* Add Home featured Widget areas
  60. add_action( 'genesis_after_content_sidebar_wrap', 'minimum_home_bottom_featured', 15 );
  61.  
  62. }
  63. }
  64.  
  65. //* Add markup for homepage widgets
  66. function minimum_home_featured() {
  67.  
  68. printf( '<div %s>', genesis_attr( 'home-featured' ) );
  69. genesis_structural_wrap( 'home-featured' );
  70.  
  71. genesis_widget_area( 'home-featured-1', array(
  72. 'before' => '<div class="home-featured-1 widget-area">',
  73. 'after' => '</div>',
  74. ) );
  75.  
  76. genesis_widget_area( 'home-featured-2', array(
  77. 'before' => '<div class="home-featured-2 widget-area">',
  78. 'after' => '</div>',
  79. ) );
  80.  
  81. genesis_widget_area( 'home-featured-3', array(
  82. 'before' => '<div class="home-featured-3 widget-area">',
  83. 'after' => '</div>',
  84. ) );
  85.  
  86. genesis_widget_area( 'home-featured-4', array(
  87. 'before' => '<div class="home-featured-4 widget-area">',
  88. 'after' => '</div>',
  89. ) );
  90.  
  91. genesis_structural_wrap( 'home-featured', 'close' );
  92. echo '</div>'; //* end .home-featured
  93.  
  94. }
  95.  
  96. //* Add markup for homepage bottom widgets
  97. function minimum_home_bottom_featured() {
  98.  
  99. printf( '<div %s>', genesis_attr( 'home-featured' ) );
  100. genesis_structural_wrap( 'home-featured' );
  101.  
  102. genesis_widget_area( 'home-botom-1', array(
  103. 'before' => '<div class="home-botom-1 home-featured-1 widget-area">',
  104. 'after' => '</div>',
  105. ) );
  106.  
  107. genesis_widget_area( 'home-botom-2', array(
  108. 'before' => '<div class="home-botom-2 home-featured-2 widget-area">',
  109. 'after' => '</div>',
  110. ) );
  111.  
  112. genesis_widget_area( 'home-botom-3', array(
  113. 'before' => '<div class="home-botom-3 home-featured-3 widget-area">',
  114. 'after' => '</div>',
  115. ) );
  116.  
  117. genesis_widget_area( 'home-botom-4', array(
  118. 'before' => '<div class="home-botom-4 home-featured-4 widget-area">',
  119. 'after' => '</div>',
  120. ) );
  121.  
  122. genesis_structural_wrap( 'home-featured', 'close' );
  123. echo '</div>'; //* end .home-featured
  124.  
  125. }
  126.  
  127. //* Genesis grid loop
  128. function minimum_grid_loop_helper() {
  129.  
  130. if ( function_exists( 'genesis_grid_loop' ) ) {
  131. genesis_grid_loop( array(
  132. 'features' => 0,
  133. 'feature_image_size' => 0,
  134. 'feature_content_limit' => 0,
  135. 'grid_image_size' => 0,
  136. 'grid_content_limit' => 250,
  137. 'more' => __( '[Read more]', 'minimum' ),
  138. ) );
  139. } else {
  140.  
  141. genesis_standard_loop();
  142.  
  143. }
  144.  
  145. }
  146.  
  147. //* Run the Genesis loop
  148. genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement