Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Functions
- *
- * @package Emi Kirschner
- * @author Crystal Colson <info@crystalcolson.com>
- * @copyright Copyright (c) 2015, Crystal Colson
- * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
- *
- */
- //* Start the engine
- include_once( get_template_directory() . '/lib/init.php' );
- //* Child theme (do not remove)
- define( 'CHILD_THEME_NAME', 'Emi Kirschner' );
- define( 'CHILD_THEME_URL', 'http://www.emikirschner.com/' );
- define( 'CHILD_THEME_VERSION', '2.2.2' );
- //* Enqueue Google Fonts
- add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
- function genesis_sample_google_fonts() {
- wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Lato:300,400,700', array(), CHILD_THEME_VERSION );
- }
- //* Add HTML5 markup structure
- add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
- //* Add viewport meta tag for mobile browsers
- add_theme_support( 'genesis-responsive-viewport' );
- //* Add support for custom background
- add_theme_support( 'custom-background' );
- //* Add support for 3-column footer widgets
- add_theme_support( 'genesis-footer-widgets', 1 );
- //* Register Horizontal Opt-In widget area
- genesis_register_sidebar(
- array(
- 'id' => 'horizontal-opt-in',
- 'name' => __( 'Horizontal Opt-In' ),
- 'description' => __( 'This is the widget area for horizontal opt-in form.' ),
- ) );
- //* Display Horizontal Opt-In below Header
- add_action( 'genesis_after_header', 'sk_horizontal_opt_in' );
- function sk_horizontal_opt_in() {
- genesis_widget_area( 'horizontal-opt-in', array(
- 'before' => '<div class="horizontal-opt-in widget-area"><div class="wrap">',
- 'after' => '</div></div>',
- ) );
- }
- //* Reposition the primary navigation menu
- remove_action( 'genesis_after_header', 'genesis_do_nav' );
- add_action( 'genesis_before_header', 'genesis_do_nav', 12 );
- /** Move secondary nav menu */
- remove_action( 'genesis_after_header', 'genesis_do_subnav' );
- add_action( 'genesis_after_footer', 'genesis_do_subnav' );
- //* Add support for structural wraps
- add_theme_support( 'genesis-structural-wraps', array(
- 'header',
- 'nav',
- 'subnav',
- 'site-inner',
- 'footer-widgets',
- 'footer',
- 'header-image'
- ) );
- add_action( 'genesis_entry_content', 'sk_show_featured_image_single_posts', 9 );
- //* Remove the header right widget area
- unregister_sidebar( 'header-right' );
- /**
- * Display Featured Image floated to the right in single Posts.
- *
- * @author Sridhar Katakam
- * @link http://sridharkatakam.com/how-to-display-featured-image-in-single-posts-in-genesis/
- */
- function sk_show_featured_image_single_posts() {
- if ( ! is_singular( 'post' ) ) {
- return;
- }
- $image_args = array(
- 'size' => 'medium',
- 'attr' => array(
- 'class' => 'alignright',
- ),
- );
- genesis_image( $image_args );
- }
- //* Customize the entire footer
- remove_action( 'genesis_footer', 'genesis_do_footer' );
- add_action( 'genesis_footer', 'sp_custom_footer' );
- function sp_custom_footer() {
- ?>
- <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>
- <?php
- }
- //* Remove the post meta function
- remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
- //* Register Home Featured widget area
- genesis_register_sidebar( array(
- 'id' => 'home-featured',
- 'name' => 'Home Featured',
- 'description' => 'This is the home featured section'
- ) );
- add_action( 'genesis_entry_content', 'sk_featured_posts' );
- /**
- * Display Home Featured widget area after content.
- *
- * @author Sridhar Katakam
- * @link http://sridharkatakam.com/display-genesis-featured-widget-amplified-output-columns/
- */
- function sk_featured_posts() {
- if ( is_home() || is_front_page() ) {
- genesis_widget_area( 'home-featured', array(
- 'before' => '<div class="home-featured widget-area"><div class="wrap">',
- 'after' => '</div></div>',
- ) );
- }
- }
- //* Modify the Excerpt read more link
- function new_excerpt_more($more) {
- return '<a class="more-link" href="' . get_permalink() . '"> [Continue Reading]</a>';
- }
- add_filter('excerpt_more', 'new_excerpt_more');
- /** Add the featured image section */
- add_action( 'genesis_after_header', 'full_featured_image',8 );
- function full_featured_image() {
- if ( is_front_page() ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo.png" /></a></div>';
- }
- elseif ( is_page( 'about' ) ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-about.png" /></a></div>';
- }
- elseif ( is_page( array('programs','coaching','french-fries-to-foodies') ) ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-programs.png" /></a></div>';
- }
- elseif ( is_page( 'speaking' ) ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-speaking.png" /></a></div>';
- }
- elseif ( is_page( array( 'shop', 'emis-favorite-things' ) ) ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-shop.png" /></a></div>';
- }
- elseif ( is_page( 'contact' ) ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-contact.png" /></a></div>';
- }
- elseif ( is_home() ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-blog.png" /></a></div>';
- }
- elseif ( is_single() ) {
- echo '<div id="full-image"><a href="http://www.emikirschner.com"><img src="'. get_stylesheet_directory_uri() . '/images/logo-blog.png" /></a></div>';
- }
- elseif ( is_singular( array( 'post', 'page' ) ) && has_post_thumbnail() ){
- echo '<div id="full-image">';
- echo get_the_post_thumbnail($thumbnail->ID, 'header');
- echo '</div>';
- }
- }
- // Register Home Featured widget area
- genesis_register_sidebar( array(
- 'id' => 'home-featured',
- 'name' => __( 'Home Featured', 'themename' ),
- 'description' => __( 'This is the home featured widget area', 'themename' ),
- ) );
- // Display Home Featured widget area below header on front page
- add_action( 'genesis_after_header', 'sk_horizontal_gf' );
- function sk_horizontal_gf() {
- // if ( ! is_front_page() ) {
- // return;
- // }
- genesis_widget_area( 'home-featured', array(
- 'before' => '<div class="home-featured widget-area"><div class="wrap">',
- 'after' => '</div></div>',
- ) );
- }
- // Enable the setting to hide Sub-Labels on Gravity Forms' Advanced Fields
- add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
- // Add a custom body class to front page after the GF form has been submitted
- add_action( 'gform_after_submission_2', 'sk_after_submission', 10, 2 );
- function sk_after_submission() {
- // if ( ! is_front_page() ) {
- // return;
- // }
- add_filter( 'body_class', 'sk_gf_body_class' );
- }
- /**
- * Adds a css class to the body element
- *
- * @param array $classes the current body classes
- * @return array $classes modified classes
- */
- function sk_gf_body_class( $classes ) {
- $classes[] = 'form-submitted';
- return $classes;
- }
- /** Add new image sizes */
- add_image_size( 'header', 1400, 351, TRUE );
- add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement