__( 'Menu', 'captivating' ),
'menuIconClass' => 'dashicons-before dashicons-menu',
'subMenu' => __( 'Submenu', 'captivating' ),
'subMenuIconsClass' => 'dashicons-before dashicons-arrow-down-alt2',
'menuClasses' => array(
'combine' => array(
'.nav-header',
'.nav-header-left',
'.nav-header-right',
'.nav-secondary',
'.nav-primary',
),
'others' => array(
'.nav-footer',
),
),
);
return $settings;
}
//* Add support for footer menu & rename menus
add_theme_support ( 'genesis-menus' , array (
'primary' => 'Above Header Menu',
'secondary' => 'Below Header Menu',
'header-left' => 'Header Left',
'header-right' => 'Header Right',
'footer' => 'Footer Menu'
) );
//* Add HTML5 markup structure
add_theme_support( 'html5' );
//* Add new featured image sizes
add_image_size( 'square-entry-image', 400, 400, TRUE );
add_image_size( 'vertical-entry-image', 400, 600, TRUE );
add_image_size( 'horizontal-entry-image', 820, 550, TRUE );
//* Add support for 3-column footer widgets
add_theme_support( 'genesis-footer-widgets', 3 );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Add support for custom background
add_theme_support( 'custom-background', array(
'default-color' => 'FFFFFF',
));
//* Add support for after entry widget
add_theme_support( 'genesis-after-entry-widget-area' );
//* Add support for custom header
add_theme_support( 'custom-header', array(
'width' => 2000,
'height' => 1562,
'header-selector' => '.site-title a',
'header-text' => false,
) );
//* Remove the site description
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
//* 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' );
//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_header', 'genesis_do_nav', 7 );
//* Add search form to navigation
add_filter( 'wp_nav_menu_items', 'captivating_primary_nav_extras', 10, 2 );
function captivating_primary_nav_extras( $menu, $args ) {
if ( 'primary' !== $args->theme_location ) {
return $menu;
}
ob_start();
get_search_form();
$search = ob_get_clean();
$menu .= '
' . $search . '';
return $menu;
}
//* Add widget to primary navigation
add_filter( 'genesis_nav_items', 'captivating_social_icons', 10, 2 );
add_filter( 'wp_nav_menu_items', 'captivating_social_icons', 10, 2 );
function captivating_social_icons($menu, $args) {
$args = (array)$args;
if ( 'primary' !== $args['theme_location'] )
return $menu;
ob_start();
genesis_widget_area('nav-social-menu');
$social = ob_get_clean();
return $menu . $social;
}
//* Hook menu to left of Logo
add_action( 'genesis_header', 'captivating_header_left_menu', 6 );
function captivating_header_left_menu() {
genesis_nav_menu( array(
'theme_location' => 'header-left',
'depth' => 2,
) );
}
//* Hook menu to right of Logo
add_action( 'genesis_header', 'captivating_header_right_menu', 9 );
function captivating_header_right_menu() {
genesis_nav_menu( array(
'theme_location' => 'header-right',
'depth' => 2,
) );
}
//* Hook menu in footer
add_action( 'genesis_before_footer', 'captivating_footer_menu', 7 );
function captivating_footer_menu() {
genesis_nav_menu( array(
'theme_location' => 'footer',
'depth' => 1,
) );
}
//* Reposition Featured Images
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 5 );
//* Reposition Post Info Above Post Title
remove_action( 'genesis_entry_header', 'genesis_post_info', 12);
add_action( 'genesis_entry_header', 'genesis_post_info', 9 );
//* Reposition Post Meta Below Post Title
remove_action( 'genesis_entry_footer', 'genesis_post_meta');
add_action( 'genesis_entry_header', 'genesis_post_meta', 12 );
//* Customize the Post Info Function
add_filter( 'genesis_post_info', 'captivating_post_info_filter' );
function captivating_post_info_filter( $post_info ) {
$post_info = '[post_date] · [post_comments before="" zero="Leave a Comment" one="1 Comment" more="% Comments"]';
return $post_info;
}
//* Customize the Post Meta function
add_filter( 'genesis_post_meta', 'captivating_post_meta_filter' );
function captivating_post_meta_filter( $post_meta ) {
$post_meta = '[post_categories before="" sep="·"]';
return $post_meta;
}
//* Modify the size of the Gravatar in the entry comments
add_filter( 'genesis_comment_list_args', 'captivating_comments_gravatar' );
function captivating_comments_gravatar( $args ) {
$args['avatar_size'] = 96;
return $args;
}
//* Modify the size of the Gravatar in the author box
add_filter( 'genesis_author_box_gravatar_size', 'captivating_author_box_gravatar' );
function captivating_author_box_gravatar( $size ) {
return 200;
}
//* Customize search form input box text
add_filter( 'genesis_search_text', 'captivating_search_text' );
function captivating_search_text( $text ) {
return esc_attr( 'Search . . .' );
}
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'captivating_remove_comment_form_allowed_tags' );
function captivating_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
// Customize 'Read More' text with accessibility.
add_filter( 'excerpt_more', 'captivating_read_more_link' );
add_filter( 'get_the_content_more_link', 'captivating_read_more_link' );
add_filter( 'the_content_more_link', 'captivating_read_more_link' );
function captivating_read_more_link($more) {
$new_a11y_read_more_title = sprintf( '%s %s', __( 'about ', 'captivating' ), get_the_title() );
return sprintf( ' ... %s %s', get_permalink(), __( 'Read More', 'captivating' ), $new_a11y_read_more_title );
}
//* Hooks Announcement Widget
add_action( 'genesis_before', 'captivating_announcement_widget', 8 );
function captivating_announcement_widget() {
genesis_widget_area( 'announcement-widget', array(
'before' => '',
) );
}
//* Hooks Widget Area Above Content
add_action( 'genesis_before_footer', 'captivating_site_wide_cta', 6 );
function captivating_site_wide_cta() {
if ( !is_home() ){
genesis_widget_area( 'site-wide-cta', array(
'before' => '',
) );
}}
//* Hooks Widget Area Below Footer
add_action( 'genesis_before_footer', 'captivating_widget_below_footer', 12 );
function captivating_widget_below_footer() {
genesis_widget_area( 'widget-below-footer', array(
'before' => '',
) );
}
//* Force 12 posts to appear on all archive pages
add_action('pre_get_posts', 'captivating_change_posts_per_page', 1);
function captivating_change_posts_per_page( $query ) {
if( ! $query->is_main_query() )
return;
if ( is_archive() ){
$query->set( 'posts_per_page', 12); //* This changes the # of posts displayed on the category pages
}
}
//* Load Entry Navigation
add_action( 'genesis_after_entry', 'genesis_prev_next_post_nav', 9 );
//* Customize the credits
add_filter('genesis_pre_get_option_footer_text', 'captivating_footer_creds_text');
function captivating_footer_creds_text( $creds ) {
$creds = 'Copyright [footer_copyright] · Cottage at the Crossroads
';
return $creds;
}
//* Add Theme Support for WooCommerce
add_theme_support( 'genesis-connect-woocommerce' );
//* Remove Related Products
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
//* Change number or products per row to 3
add_filter('loop_shop_columns', 'loop_columns');
if (!function_exists('loop_columns')) {
function loop_columns() {
return 3; // 3 products per row
}
}
//* Add WooCommerce Gallery Options
add_action( 'after_setup_theme', 'captivating_woo_gallery' );
function captivating_woo_gallery() {
//add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
//* Add WP Recipe Maker Jump to Recipe
add_action('genesis_entry_content', 'captivating_wprm_buttons', 1);
function captivating_wprm_buttons() {
if ( is_single() && ( shortcode_exists( 'wprm-recipe-jump' ) || shortcode_exists( 'wprm-recipe-print' ) ) ) {
echo '';
if ( shortcode_exists( 'wprm-recipe-jump' ) ) {
echo do_shortcode( '[wprm-recipe-jump]' );
}
echo '
';
}
}
//* ##################################################################### *//
//* Add Amazon statement after after 2nd paragraph of single post content.
add_filter( 'the_content', 'prefix_insert_post_ads' );
function prefix_insert_post_ads( $content ) {
$ad_code = 'This post may contain Amazon or other affiliate links. As an Amazon associate, I earn from qualifying purchases. If you purchase anything through any affiliate link, I may earn a small commission at no extra charge to you. All opinions are my own.
';
if ( is_single() && ! is_admin() ) {
return prefix_insert_after_paragraph( $ad_code, 2, $content );
}
return $content;
}
function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
$closing_p = '';
$paragraphs = explode( $closing_p, $content );
foreach ($paragraphs as $index => $paragraph) {
if ( trim( $paragraph ) ) {
$paragraphs[$index] .= $closing_p;
}
if ( $paragraph_id == $index + 1 ) {
$paragraphs[$index] .= $insertion;
}
}
return implode( '', $paragraphs );
}