'300px by 300px' ) ); } /************* ACTIVE SIDEBARS ********************/ // Sidebars & Widgetizes Areas function bohaute_register_sidebars() { register_sidebar(array( 'id' => 'sidebar1', 'name' => __( 'Posts Sidebar', 'bohaute' ), 'description' => __( 'The Posts sidebar.', 'bohaute' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar2', 'name' => __( 'Page Sidebar', 'bohaute' ), 'description' => __( 'The Page sidebar.', 'bohaute' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } // don't remove this bracket! /************* COMMENT LAYOUT *********************/ // Comment Layout function bohaute_comments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; ?>
>
' ); */ ?>
comment_approved == '0') : ?>

%1$s %2$s', 'bohaute' ), get_comment_author_link(), edit_comment_link(__( '(Edit)', 'bohaute' ),' ','') ) ?>
$depth, 'max_depth' => $args['max_depth']))) ?>
is added by WordPress automatically ?> add_setting( 'bohaute_color_settings', array ( 'default' => '#c9a96e', 'sanitize_callback' => 'sanitize_hex_color', ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'bohaute_color_settings', array( 'label' => __( 'Theme Color Scheme', 'bohaute' ), 'section' => 'colors', 'settings' => 'bohaute_color_settings', ) ) ); if ( !function_exists( 'the_custom_logo' )) { /* logo fallback option */ $wp_customize->add_section( 'bohaute_logo_section' , array( 'title' => __( 'Site Logo', 'bohaute' ), 'priority' => 1, 'description' => __( 'Upload a logo to replace the default site name in the header', 'bohaute' ), ) ); $wp_customize->add_setting( 'bohaute_logo', array( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'bohaute_logo', array( 'label' => __( 'Choose your logo (ideal width is 100-350px and ideal height is 35-40)', 'bohaute' ), 'section' => 'bohaute_logo_section', 'settings' => 'bohaute_logo', ) ) ); } /* social media option */ $wp_customize->add_section( 'bohaute_social_section' , array( 'title' => __( 'Social Media Icons', 'bohaute' ), 'priority' => 32, 'description' => __( 'Optional media icons in the header', 'bohaute' ), ) ); $wp_customize->add_setting( 'bohaute_facebook', array ( 'sanitize_callback' => 'esc_url_raw', ) ); /* author bio in posts option */ $wp_customize->add_section( 'bohaute_posts_section' , array( 'title' => __( 'Post Settings', 'bohaute' ), 'priority' => 35, 'description' => __( '', 'bohaute' ), ) ); $wp_customize->add_setting( 'bohaute_related_posts', array ( 'sanitize_callback' => 'bohaute_sanitize_checkbox', ) ); $wp_customize->add_control('related_posts', array( 'settings' => 'bohaute_related_posts', 'label' => __('Disable the Related Posts?', 'bohaute'), 'section' => 'bohaute_posts_section', 'type' => 'checkbox', )); $wp_customize->add_setting( 'bohaute_author_area', array ( 'sanitize_callback' => 'bohaute_sanitize_checkbox', ) ); $wp_customize->add_control('author_info', array( 'settings' => 'bohaute_author_area', 'label' => __('Disable the Author Information?', 'bohaute'), 'section' => 'bohaute_posts_section', 'type' => 'checkbox', )); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_facebook', array( 'label' => __( 'Enter your Facebook url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_facebook', 'priority' => 101, ) ) ); $wp_customize->add_setting( 'bohaute_twitter', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_twitter', array( 'label' => __( 'Enter your Twitter url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_twitter', 'priority' => 102, ) ) ); $wp_customize->add_setting( 'bohaute_google', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_google', array( 'label' => __( 'Enter your Google+ url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_google', 'priority' => 103, ) ) ); $wp_customize->add_setting( 'bohaute_pinterest', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_pinterest', array( 'label' => __( 'Enter your Pinterest url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_pinterest', 'priority' => 104, ) ) ); $wp_customize->add_setting( 'bohaute_linkedin', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_linkedin', array( 'label' => __( 'Enter your Linkedin url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_linkedin', 'priority' => 105, ) ) ); $wp_customize->add_setting( 'bohaute_youtube', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_youtube', array( 'label' => __( 'Enter your Youtube url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_youtube', 'priority' => 106, ) ) ); $wp_customize->add_setting( 'bohaute_tumblr', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_tumblr', array( 'label' => __( 'Enter your Tumblr url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_tumblr', 'priority' => 107, ) ) ); $wp_customize->add_setting( 'bohaute_instagram', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_instagram', array( 'label' => __( 'Enter your Instagram url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_instagram', 'priority' => 108, ) ) ); $wp_customize->add_setting( 'bohaute_flickr', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_flickr', array( 'label' => __( 'Enter your Flickr url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_flickr', 'priority' => 109, ) ) ); $wp_customize->add_setting( 'bohaute_vimeo', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_vimeo', array( 'label' => __( 'Enter your Vimeo url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_vimeo', 'priority' => 110, ) ) ); $wp_customize->add_setting( 'bohaute_rss', array ( 'sanitize_callback' => 'esc_url_raw', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_rss', array( 'label' => __( 'Enter your RSS url', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_rss', 'priority' => 112, ) ) ); $wp_customize->add_setting( 'bohaute_email', array ( 'sanitize_callback' => 'sanitize_email', ) ); $wp_customize->add_control( new WP_Customize_Control( $wp_customize, 'bohaute_email', array( 'label' => __( 'Enter your email address', 'bohaute' ), 'section' => 'bohaute_social_section', 'settings' => 'bohaute_email', 'priority' => 113, ) ) ); } endif; add_action('customize_register', 'bohaute_theme_customizer'); /** * Sanitize checkbox */ if ( ! function_exists( 'bohaute_sanitize_checkbox' ) ) : function bohaute_sanitize_checkbox( $input ) { if ( $input == 1 ) { return 1; } else { return ''; } } endif; /** * Sanitize integer input */ if ( ! function_exists( 'bohaute_sanitize_integer' ) ) : function bohaute_sanitize_integer( $input ) { return absint($input); } endif; /** * Apply Color Scheme */ if ( ! function_exists( 'bohaute_apply_color' ) ) : function bohaute_apply_color() { if ( get_theme_mod('bohaute_color_settings') ) : ?> query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1; $pagination = array( 'base' => @add_query_arg('page','%#%'), 'format' => '', 'total' => $wp_query->max_num_pages, 'current' => $current, 'show_all' => true, 'type' => 'list', 'next_text' => '»', 'prev_text' => '«' ); if( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 'page', get_pagenum_link( 1 ) ) ) . '?page=%#%/', 'paged' ); if( !empty($wp_query->query_vars['s']) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) ); echo paginate_links( $pagination ); } function bohaute_oembed() { global $post; if ( $post && $post->post_content ) { global $shortcode_tags; // Make a copy of global shortcode tags - we'll temporarily overwrite it. $theme_shortcode_tags = $shortcode_tags; // The shortcodes we're interested in. $shortcode_tags = array( 'video' => $theme_shortcode_tags['video'], 'audio' => $theme_shortcode_tags['audio'], 'embed' => $theme_shortcode_tags['embed'] ); // Get the absurd shortcode regexp. $video_regex = '#' . get_shortcode_regex() . '#i'; // Restore global shortcode tags. $shortcode_tags = $theme_shortcode_tags; $pattern_array = array( $video_regex ); // Get the patterns from the embed object. if ( ! function_exists( '_wp_oembed_get_object' ) ) { include ABSPATH . WPINC . '/class-oembed.php'; } $oembed = _wp_oembed_get_object(); $pattern_array = array_merge( $pattern_array, array_keys( $oembed->providers ) ); // Or all the patterns together. $pattern = '#(' . array_reduce( $pattern_array, function ( $carry, $item ) { if ( strpos( $item, '#' ) === 0 ) { // Assuming '#...#i' regexps. $item = substr( $item, 1, -2 ); } else { // Assuming glob patterns. $item = str_replace( '*', '(.+)', $item ); } return $carry ? $carry . ')|(' . $item : $item; } ) . ')#is'; // Simplistic parse of content line by line. $lines = explode( "\n", $post->post_content ); foreach ( $lines as $line ) { $line = trim( $line ); if ( preg_match( $pattern, $line, $matches ) ) { if ( strpos( $matches[0], '[' ) === 0 ) { $ret = do_shortcode( $matches[0] ); $audio = explode('"', $matches[0]); if( array_key_exists(1, $audio)){ return $audio[1]; } } else { $ret = wp_oembed_get( $matches[0] ); } return $ret; } } } } function bohaute_author_excerpt() { $text_limit = '50'; //Words to show in author bio excerpt $read_more = "Read more"; //Read more text $end_of_txt = "..."; $name_of_author = get_the_author(); $url_of_author = get_author_posts_url(get_the_author_meta('ID')); $short_desc_author = wp_trim_words(strip_tags( get_the_author_meta('description')), $text_limit, $end_of_txt.'
'.$read_more .''); return $short_desc_author; } function bohaute_catch_that_image() { global $post; $pattern = '||'; $transformed_content = apply_filters('the_content',$post->post_content); preg_match($pattern,$transformed_content,$matches); if (!empty($matches[1])) { $classes = explode(' ',$matches[1]); $id = preg_grep('|^wp-image-.*|',$classes); if (!empty($id)) { $id = str_replace('wp-image-','',$id); if (!empty($id)) { $id = reset($id); $transformed_content = wp_get_attachment_image($id,'full'); return $transformed_content; } } } } function bohaute_catch_that_image_thumb() { global $post; $pattern = '||'; $transformed_content = apply_filters('the_content',$post->post_content); preg_match($pattern,$transformed_content,$matches); if (!empty($matches[1])) { $classes = explode(' ',$matches[1]); $id = preg_grep('|^wp-image-.*|',$classes); if (!empty($id)) { $id = str_replace('wp-image-','',$id); if (!empty($id)) { $id = reset($id); $transformed_content = wp_get_attachment_image($id,'thumbnail'); return $transformed_content; } } } } function bohaute_catch_gallery_image_full() { global $post; $gallery = get_post_gallery( $post, false ); if ( !empty($gallery['ids']) ) { $ids = explode( ",", $gallery['ids'] ); $total_images = 0; foreach( $ids as $id ) { $title = get_post_field('post_title', $id); $meta = get_post_field('post_excerpt', $id); $link = wp_get_attachment_url( $id ); $image = wp_get_attachment_image( $id, 'full'); $total_images++; if ($total_images == 1) { $first_img = $image; return $first_img; } } } } function bohaute_catch_gallery_image_thumb() { global $post; $gallery = get_post_gallery( $post, false ); if ( !empty($gallery['ids']) ) { $ids = explode( ",", $gallery['ids'] ); $total_images = 0; foreach( $ids as $id ) { $title = get_post_field('post_title', $id); $meta = get_post_field('post_excerpt', $id); $link = wp_get_attachment_url( $id ); $image = wp_get_attachment_image( $id, 'thumbnail'); $total_images++; if ($total_images == 1) { $first_img = $image; return $first_img; } } } } /* social icons*/ function bohaute_social_icons() { $social_networks = array( array( 'name' => __('Facebook','bohaute'), 'theme_mode' => 'bohaute_facebook','icon' => 'fa-facebook' ), array( 'name' => __('Twitter','bohaute'), 'theme_mode' => 'bohaute_twitter','icon' => 'fa-twitter' ), array( 'name' => __('Google+','bohaute'), 'theme_mode' => 'bohaute_google','icon' => 'fa-google-plus' ), array( 'name' => __('Pinterest','bohaute'), 'theme_mode' => 'bohaute_pinterest','icon' => 'fa-pinterest' ), array( 'name' => __('Linkedin','bohaute'), 'theme_mode' => 'bohaute_linkedin','icon' => 'fa-linkedin' ), array( 'name' => __('Youtube','bohaute'), 'theme_mode' => 'bohaute_youtube','icon' => 'fa-youtube' ), array( 'name' => __('Tumblr','bohaute'), 'theme_mode' => 'bohaute_tumblr','icon' => 'fa-tumblr' ), array( 'name' => __('Instagram','bohaute'), 'theme_mode' => 'bohaute_instagram','icon' => 'fa-instagram' ), array( 'name' => __('Flickr','bohaute'), 'theme_mode' => 'bohaute_flickr','icon' => 'fa-flickr' ), array( 'name' => __('Vimeo','bohaute'), 'theme_mode' => 'bohaute_vimeo','icon' => 'fa-vimeo-square' ), array( 'name' => __('RSS','bohaute'), 'theme_mode' => 'bohaute_rss','icon' => 'fa-rss' ) ); for ($row = 0; $row < 11; $row++) { if (get_theme_mod( $social_networks[$row]["theme_mode"])): ?> 'Recent Posts Widget With Thumbnails', 'slug' => 'recent-posts-widget-with-thumbnails', 'required' => false, ), ); /** * Array of configuration settings. Amend each line as needed. * If you want the default strings to be available under your own theme domain, * leave the strings uncommented. * Some of the strings are added into a sprintf, so see the comments at the * end of each line for what each argument will be. */ $config = array( 'default_path' => '', // Default absolute path to pre-packaged plugins. 'menu' => 'bohaute-install-plugins', // Menu slug. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. 'strings' => array( 'page_title' => __( 'Install Required Plugins', 'bohaute' ), 'menu_title' => __( 'Install Plugins', 'bohaute' ), 'installing' => __( 'Installing Plugin: %s', 'bohaute' ), // %s = plugin name. 'oops' => __( 'Something went wrong with the plugin API.', 'bohaute' ), 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' , 'bohaute'), // %1$s = plugin name(s). 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' , 'bohaute'), // %1$s = plugin name(s). 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' , 'bohaute'), // %1$s = plugin name(s). 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' , 'bohaute'), // %1$s = plugin name(s). 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' , 'bohaute'), // %1$s = plugin name(s). 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' , 'bohaute'), // %1$s = plugin name(s). 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' , 'bohaute'), // %1$s = plugin name(s). 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' , 'bohaute'), // %1$s = plugin name(s). 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' , 'bohaute'), 'activate_link' => _n_noop( 'Begin activating plugin', 'Begin activating plugins' , 'bohaute'), 'return' => __( 'Return to Required Plugins Installer', 'bohaute' ), 'plugin_activated' => __( 'Plugin activated successfully.', 'bohaute' ), 'complete' => __( 'All plugins installed and activated successfully. %s', 'bohaute' ), // %s = dashboard link. 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'. ) ); tgmpa( $plugins, $config ); } /* DON'T DELETE THIS CLOSING TAG */ ?>