Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** Start the engine */
- require_once( get_template_directory() . '/lib/init.php' );
- /** Set Localization (do not remove) */
- load_child_theme_textdomain( 'minimum', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'minimum' ) );
- /** Child theme (do not remove) */
- define( 'CHILD_THEME_NAME', __( 'Minimum Theme', 'minimum' ) );
- define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/minimum' );
- /** Load Google fonts */
- add_action( 'wp_enqueue_scripts', 'minimum_load_google_fonts' );
- function minimum_load_google_fonts() {
- wp_enqueue_style(
- 'google-fonts',
- 'http://fonts.googleapis.com/css?family=Open+Sans:400,700',
- array(),
- PARENT_THEME_VERSION
- );
- }
- /** Sets Content Width */
- $content_width = apply_filters( 'content_width', 740, 740, 1140 );
- /** Add Viewport meta tag for mobile browsers */
- add_action( 'genesis_meta', 'minimum_add_viewport_meta_tag' );
- function minimum_add_viewport_meta_tag() {
- echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
- }
- /** Add new image sizes */
- add_image_size( 'header', 1600, 9999, TRUE );
- add_image_size( 'portfolio', 330, 230, TRUE );
- /** Add support for custom background */
- add_theme_support( 'custom-background' );
- /** Add support for custom header */
- add_theme_support( 'genesis-custom-header', array(
- 'width' => 1140,
- 'height' => 160
- ) );
- /** Remove Site Tag Line **/
- remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
- /**
- *
- * Display an address using
- * Genesis column classes and ACF.
- *
- * @author Angie Meeker
- * @uses Advanced Custom Fields
- */
- add_action( 'genesis_post_content', 'theme_prefix_address', 11 );
- function theme_prefix_address() {
- // Return early if not a single page
- if ( !is_single() )
- return;
- // Store the location data
- $location_data = array(
- 'address_1' => get_field( 'Address_1' ),
- 'address_2' => get_field( 'street_address_2' ),
- 'po_box' => get_field( 'po_box' ),
- 'city' => get_field( 'city' ),
- 'state' => get_field( 'state' ),
- 'zip' => get_field( 'zip' ),
- );
- // Only output if we have location data
- if( $location_data ) {
- echo '<div class="details">Details</div>';
- echo '<div class="location-wrap one-half first">';
- if ( $location_data['address_1'] ) {
- echo '<div class="location">' . esc_attr( $location_data['address_1'] ) . '</div>';
- }
- if ( $location_data['address_2'] ) {
- echo '<div class="location">' . esc_attr( $location_data['address_2'] ) . '</div>';
- }
- if ( $location_data['po_box'] ) {
- echo '<div class="location">' . esc_attr( $location_data['po_box'] ) . '</div>';
- }
- if ( $location_data['city'] ) {
- echo '<span>' . esc_attr( $location_data['city'] ) . '</span>';
- }
- if ( $location_data['state'] ) {
- echo '<span>, ' . esc_attr( $location_data['state'] ) . '</span>';
- }
- if ( $location_data['zip'] ) {
- echo '<span> ' . esc_attr( $location_data['zip'] ) . '</span>';
- }
- echo '</div>';
- }
- // Store the touchpoint data
- $touchpoint_data = array(
- 'phone' => get_field( 'phone' ),
- 'website' => get_field( 'website' ),
- 'email' => get_field( 'email' ),
- );
- // Only output if we have touchpoint data
- if ( $touchpoint_data ) {
- echo '<div class="touchpoints-wrap one-half">';
- if ( $touchpoint_data['phone'] ) {
- echo '<div class="touchpoint">' . esc_attr( $touchpoint_data['phone'] ) . '</div>';
- }
- if ( $touchpoint_data['website'] ) {
- echo '<div class="touchpoint"><a href="' . esc_url( $touchpoint_data['website'] ) . '">Visit Our Website</a></div>';
- }
- if ( $touchpoint_data['email'] ) {
- echo '<div class=touchpoint"><a href="mailto:' . esc_attr( $touchpoint_data['email'] ) . '">Email</a></div>';
- }
- echo '</div>';
- }
- }
- /**
- *
- * Display an tour using
- * Genesis column classes and ACF.
- *
- * @author Angie Meeker
- * @uses Advanced Custom Fields
- */
- add_action( 'genesis_post_content', 'theme_prefix_tour', 12 );
- function theme_prefix_tour() {
- // Return early if not a single page with tours tag
- if ( is_singular( 'attractions' ) && has_term ( 'tours', 'attractiontype' ) )
- return;
- // Store the tour data
- $tour_data = array(
- 'contact' => get_field( 'contact' ),
- 'admission' => get_field( 'admission' ),
- 'hours' => get_field( 'hours' ),
- 'coaches_accepted' => get_field( 'coaches_accepted' ),
- 'reservations_required' => get_field( 'reservations_required' ),
- 'length_of_tour' => get_field( 'length_of_tour' ),
- 'location_of_parking' => get_field( 'location_of_parking' ),
- 'comp_policy' => get_field( 'comp_policy' ),
- 'restrooms_available' => get_field( 'restrooms_available' ),
- 'dietary_menu_available' => get_field( 'dietary_menu_available' ),
- );
- // Only output if we have tour data
- if( $tour_data ) {
- echo '<div class="details">Tour Information</div>';
- echo '<div class="location-wrap one-half first">';
- if ( $tour_data['contact'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['contact'] ) . '</div>';
- }
- if ( $tour_data['admission'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['admission'] ) . '</div>';
- }
- if ( $tour_data['hours'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['hours'] ) . '</div>';
- }
- if ( $tour_data['coaches_accepted'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['coaches_accepted'] ) . '</div>';
- }
- if ( $tour_data['reservations_required'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['reservations_required'] ) . '</div>';
- }
- if ( $tour_data['length_of_tour'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['length_of_tour'] ) . '</div>';
- }
- if ( $tour_data['location_of_parking'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['location_of_parking'] ) . '</div>';
- }
- if ( $tour_data['comp_policy'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['comp_policy'] ) . '</div>';
- }
- if ( $tour_data['restrooms_available'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['restrooms_available'] ) . '</div>';
- }
- if ( $tour_data['dietary_menu_available'] ) {
- echo '<div class="location">' . esc_attr( $tour_data['dietary_menu_available'] ) . '</div>';
- }
- echo '</div>';
- }
- }
- /** Unregister layout settings */
- genesis_unregister_layout( 'content-sidebar-sidebar' );
- genesis_unregister_layout( 'sidebar-content-sidebar' );
- genesis_unregister_layout( 'sidebar-sidebar-content' );
- /** Unregister secondary sidebar */
- unregister_sidebar( 'sidebar-alt' );
- /** Add support for structural wraps */
- add_theme_support( 'genesis-structural-wraps', array(
- 'header',
- 'nav',
- 'subnav',
- 'inner',
- 'footer-widgets',
- 'footer-trio',
- 'footer'
- ) );
- /** Add the featured image section */
- add_action( 'genesis_after_header', 'minimum_featured_image' );
- function minimum_featured_image() {
- if ( is_home() ) {
- echo '<div id="home-featured"><div class="wrap">';
- genesis_widget_area( 'home-slider', array( 'before' => '<div class="home-slider widget-area">', ) );
- echo '</div></div>';
- }
- }
- /** Add the page title section */
- //add_action( 'genesis_after_header', 'minimum_page_title' );
- function minimum_page_title() {
- require_once( get_stylesheet_directory() . '/page-title.php' );
- }
- /** Customize the post info function */
- add_filter( 'genesis_post_info', 'post_info_filter' );
- function post_info_filter( $post_info ) {
- if ( !is_page() ) {
- $post_info = __( 'Posted on', 'minimum' ) . ' [post_date] // [post_comments] [post_edit]';
- return $post_info;
- }}
- /** Customize the post meta function */
- add_filter( 'genesis_post_meta', 'post_meta_filter' );
- function post_meta_filter( $post_meta ) {
- if ( !is_page() ) {
- $post_meta = '[post_categories before="' . __( 'Filed Under: ', 'minimum' ) . '"] // [post_tags before="' . __( 'Tagged: ', 'minimum' ) . '"]';
- return $post_meta;
- }}
- /** Modify the size of the Gravatar in the author box */
- add_filter( 'genesis_author_box_gravatar_size', 'minimum_author_box_gravatar_size' );
- function minimum_author_box_gravatar_size( $size ) {
- return '96';
- }
- /** Add support for 4-column footer widgets */
- add_theme_support( 'genesis-footer-widgets', 4 );
- /** Add footer banner if widget area is used */
- add_action( 'genesis_footer', 'minimum_footer_banner', 5 );
- function minimum_footer_banner() {
- if ( is_active_sidebar( 'home-footer-banner' ) ) {
- remove_action( 'genesis_footer', 'genesis_do_footer' );
- echo '<div class="home-footer-banner">';
- dynamic_sidebar( 'home-footer-banner' );
- echo '</div><!-- end .home-footer-banner -->';
- }
- }
- /** Add three footer widgets if widget area is used */
- add_action( 'genesis_footer', 'minimum_footer_trio', 6 );
- function minimum_footer_trio() {
- if ( is_active_sidebar( 'footer-trio1' ) ) {
- remove_action( 'genesis_footer', 'minimum_footer_trio' );
- echo '<div class="footer-trio1">';
- dynamic_sidebar( 'footer-trio1' );
- echo '</div><!-- end .minimum_footer_trio -->';
- }
- if ( is_active_sidebar( 'footer-trio2' ) ) {
- remove_action( 'genesis_footer', 'minimum_footer_trio' );
- echo '<div class="footer-trio2">';
- dynamic_sidebar( 'footer-trio2' );
- echo '</div><!-- end .minimum_footer_trio -->';
- }
- if ( is_active_sidebar( 'footer-trio3' ) ) {
- remove_action( 'genesis_footer', 'minimum_footer_trio' );
- echo '<div class="footer-trio3">';
- dynamic_sidebar( 'footer-trio3' );
- echo '</div><!-- end .minimum_footer_trio -->';
- }
- }
- /** Add custom footer if widget area is used */
- add_action( 'genesis_footer', 'minimum_custom_footer', 7 );
- function minimum_custom_footer() {
- if ( is_active_sidebar( 'custom-footer' ) ) {
- remove_action( 'genesis_footer', 'genesis_do_footer' );
- echo '<div class="custom-footer">';
- dynamic_sidebar( 'custom-footer' );
- echo '</div><!-- end .custom-footer -->';
- }
- }
- /** Create portfolio custom post type */
- add_action( 'init', 'minimum_portfolio_post_type' );
- function minimum_portfolio_post_type() {
- register_post_type( 'portfolio',
- array(
- 'labels' => array(
- 'name' => __( 'Portfolio', 'minimum' ),
- 'singular_name' => __( 'Portfolio', 'minimum' ),
- ),
- 'exclude_from_search' => true,
- 'has_archive' => true,
- 'hierarchical' => true,
- 'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/portfolio.png',
- 'public' => true,
- 'rewrite' => array( 'slug' => 'portfolio' ),
- 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'page-attributes', 'genesis-seo' ),
- )
- );
- }
- /** Change the number of portfolio items to be displayed (props Bill Erickson) */
- add_action( 'pre_get_posts', 'minimum_portfolio_items' );
- function minimum_portfolio_items( $query ) {
- if( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) {
- $query->set( 'posts_per_page', '12' );
- }
- }
- /** Add the after post section */
- add_action( 'genesis_after_post_content', 'minimum_after_post' );
- function minimum_after_post() {
- if ( ! is_singular( 'post' ) )
- return;
- genesis_widget_area( 'after-post', array(
- 'before' => '<div class="after-post widget-area">',
- ) );
- }
- /** Register widget area */
- genesis_register_sidebar( array(
- 'id' => 'home-slider',
- 'name' => __( 'Home Slider', 'minimum' ),
- 'description' => __( 'This is the home slider', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-featured-1',
- 'name' => __( 'Home Featured #1', 'minimum' ),
- 'description' => __( 'This is the home featured #1 section.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-featured-2',
- 'name' => __( 'Home Featured #2', 'minimum' ),
- 'description' => __( 'This is the home featured #2 section.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-featured-3',
- 'name' => __( 'Home Featured #3', 'minimum' ),
- 'description' => __( 'This is the home featured #3 section.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-featured-4',
- 'name' => __( 'Home Featured #4', 'minimum' ),
- 'description' => __( 'This is the home featured #4 section.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'home-footer-banner',
- 'name' => __( 'Home Footer Banner', 'minimum' ),
- 'description' => __( 'This is the home footer banner.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'footer-trio1',
- 'name' => __( 'Footer Trio 1', 'minimum' ),
- 'description' => __( 'This is the first footer trio widget.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'footer-trio2',
- 'name' => __( 'Footer Trio 2', 'minimum' ),
- 'description' => __( 'This is the second footer trio widget.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'footer-trio3',
- 'name' => __( 'Footer Trio 3', 'minimum' ),
- 'description' => __( 'This is the third footer trio widget.', 'minimum' ),
- ) );
- genesis_register_sidebar( array(
- 'id' => 'custom-footer',
- 'name' => __( 'Custom Footer', 'minimum' ),
- 'description' => __( 'This is the custom footer section.', 'minimum' ),
- ) );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement