Advertisement
Guest User

Untitled

a guest
Jul 25th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.62 KB | None | 0 0
  1. <?php
  2. /**
  3. * Functions
  4. *
  5. * @package Emi Kirschner
  6. * @author Crystal Colson <info@crystalcolson.com>
  7. * @copyright Copyright (c) 2015, Crystal Colson
  8. * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
  9. *
  10. */
  11.  
  12. //* Start the engine
  13. include_once( get_template_directory() . '/lib/init.php' );
  14.  
  15. //* Child theme (do not remove)
  16. define( 'CHILD_THEME_NAME', 'Emi Kirschner' );
  17. define( 'CHILD_THEME_URL', 'http://www.emikirschner.com/' );
  18. define( 'CHILD_THEME_VERSION', '2.2.2' );
  19.  
  20. //* Enqueue Google Fonts
  21. add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
  22. function genesis_sample_google_fonts() {
  23. wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,400,700', array(), CHILD_THEME_VERSION );
  24. }
  25.  
  26. //* Add HTML5 markup structure
  27. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
  28. //* Add viewport meta tag for mobile browsers
  29. add_theme_support( 'genesis-responsive-viewport' );
  30. //* Add support for custom background
  31. add_theme_support( 'custom-background' );
  32. //* Add support for 3-column footer widgets
  33. add_theme_support( 'genesis-footer-widgets', 1 );
  34.  
  35. //* Register Horizontal Opt-In widget area
  36. genesis_register_sidebar(
  37. array(
  38. 'id' => 'horizontal-opt-in',
  39. 'name' => __( 'Horizontal Opt-In' ),
  40. 'description' => __( 'This is the widget area for horizontal opt-in form.' ),
  41. ) );
  42.  
  43. //* Display Horizontal Opt-In below Header
  44. add_action( 'genesis_after_header', 'sk_horizontal_opt_in' );
  45. function sk_horizontal_opt_in() {
  46. genesis_widget_area( 'horizontal-opt-in', array(
  47. 'before' => '<div class="horizontal-opt-in widget-area"><div class="wrap">',
  48. 'after' => '</div></div>',
  49. ) );
  50. }
  51.  
  52. //* Reposition the primary navigation menu
  53. remove_action( 'genesis_after_header', 'genesis_do_nav' );
  54. add_action( 'genesis_before_header', 'genesis_do_nav', 12 );
  55.  
  56. /** Move secondary nav menu */
  57. remove_action( 'genesis_after_header', 'genesis_do_subnav' );
  58. add_action( 'genesis_after_footer', 'genesis_do_subnav' );
  59.  
  60. //* Add support for structural wraps
  61. add_theme_support( 'genesis-structural-wraps', array(
  62. 'header',
  63. 'nav',
  64. 'subnav',
  65. 'site-inner',
  66. 'footer-widgets',
  67. 'footer',
  68. 'header-image'
  69. ) );
  70.  
  71. add_action( 'genesis_entry_content', 'sk_show_featured_image_single_posts', 9 );
  72.  
  73. //* Remove the header right widget area
  74. unregister_sidebar( 'header-right' );
  75.  
  76. /**
  77. * Display Featured Image floated to the right in single Posts.
  78. *
  79. * @author Sridhar Katakam
  80. * @link http://sridharkatakam.com/how-to-display-featured-image-in-single-posts-in-genesis/
  81. */
  82. function sk_show_featured_image_single_posts() {
  83. if ( ! is_singular( 'post' ) ) {
  84. return;
  85. }
  86.  
  87. $image_args = array(
  88. 'size' => 'medium',
  89. 'attr' => array(
  90. 'class' => 'alignright',
  91. ),
  92. );
  93.  
  94. genesis_image( $image_args );
  95. }
  96.  
  97. //* Customize the entire footer
  98. remove_action( 'genesis_footer', 'genesis_do_footer' );
  99. add_action( 'genesis_footer', 'sp_custom_footer' );
  100. function sp_custom_footer() {
  101. ?>
  102. <div class="creds"><p>Copyright © 2015 <a href="http://www.emikirschner.com">EmiKirschner.com</a> | Designed by Caitlin Merto Designs | Photography by Leave It to Me Photography</p></div>
  103. <?php
  104. }
  105.  
  106. //* Remove the post meta function
  107. remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
  108.  
  109.  
  110. //* Register Home Featured widget area
  111. genesis_register_sidebar( array(
  112. 'id' => 'home-featured',
  113. 'name' => 'Home Featured',
  114. 'description' => 'This is the home featured section'
  115. ) );
  116. add_action( 'genesis_entry_content', 'sk_featured_posts' );
  117. /**
  118. * Display Home Featured widget area after content.
  119. *
  120. * @author Sridhar Katakam
  121. * @link http://sridharkatakam.com/display-genesis-featured-widget-amplified-output-columns/
  122. */
  123. function sk_featured_posts() {
  124. if ( is_home() || is_front_page() ) {
  125. genesis_widget_area( 'home-featured', array(
  126. 'before' => '<div class="home-featured widget-area"><div class="wrap">',
  127. 'after' => '</div></div>',
  128. ) );
  129. }
  130. }
  131.  
  132. //* Modify the Excerpt read more link
  133.  
  134. function new_excerpt_more($more) {
  135. return '<a class="more-link" href="' . get_permalink() . '"> [Continue Reading]</a>';
  136. }
  137. add_filter('excerpt_more', 'new_excerpt_more');
  138.  
  139. /** Add the featured image section */
  140. add_action( 'genesis_after_header', 'full_featured_image',8 );
  141. function full_featured_image() {
  142. if ( is_front_page() ) {
  143. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo.png" /></a></div>';
  144. }
  145. elseif ( is_page( 'about' ) ) {
  146. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-about.png" /></a></div>';
  147. }
  148. elseif ( is_page( array('programs','coaching','french-fries-to-foodies') ) ) {
  149. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-programs.png" /></a></div>';
  150. }
  151. elseif ( is_page( 'speaking' ) ) {
  152. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-speaking.png" /></a></div>';
  153. }
  154. elseif ( is_page( array( 'shop', 'emis-favorite-things' ) ) ) {
  155. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-shop.png" /></a></div>';
  156. }
  157. elseif ( is_page( 'contact' ) ) {
  158. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-contact.png" /></a></div>';
  159. }
  160. elseif ( is_home() ) {
  161. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-blog.png" /></a></div>';
  162. }
  163. elseif ( is_single() ) {
  164. echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-blog.png" /></a></div>';
  165. }
  166.  
  167. elseif ( is_singular( array( 'post', 'page' ) ) && has_post_thumbnail() ){
  168. echo '<div id="full-image">';
  169. echo get_the_post_thumbnail($thumbnail->ID, 'header');
  170. echo '</div>';
  171. }
  172. }
  173.  
  174. // Register Home Featured widget area
  175. genesis_register_sidebar( array(
  176. 'id' => 'home-featured',
  177. 'name' => __( 'Home Featured', 'themename' ),
  178. 'description' => __( 'This is the home featured widget area', 'themename' ),
  179. ) );
  180.  
  181. // Display Home Featured widget area below header on front page
  182. add_action( 'genesis_after_header', 'sk_horizontal_gf' );
  183. function sk_horizontal_gf() {
  184. // if ( ! is_front_page() ) {
  185. // return;
  186. // }
  187. genesis_widget_area( 'home-featured', array(
  188. 'before' => '<div class="home-featured widget-area"><div class="wrap">',
  189. 'after' => '</div></div>',
  190. ) );
  191. }
  192.  
  193. // Enable the setting to hide Sub-Labels on Gravity Forms' Advanced Fields
  194. add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
  195.  
  196. // Add a custom body class to front page after the GF form has been submitted
  197. add_action( 'gform_after_submission_2', 'sk_after_submission', 10, 2 );
  198. function sk_after_submission() {
  199. // if ( ! is_front_page() ) {
  200. // return;
  201. // }
  202.  
  203. add_filter( 'body_class', 'sk_gf_body_class' );
  204. }
  205.  
  206. /**
  207. * Adds a css class to the body element
  208. *
  209. * @param array $classes the current body classes
  210. * @return array $classes modified classes
  211. */
  212. function sk_gf_body_class( $classes ) {
  213. $classes[] = 'form-submitted';
  214. return $classes;
  215. }
  216.  
  217. /** Add new image sizes */
  218. add_image_size( 'header', 1400, 351, TRUE );
  219.  
  220. add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement