comment_type || 'trackback' == $comment->comment_type ) : ?>
  • >
    ', '' ); ?>
  • >
    %2$s', sprintf( '%s', get_comment_author_link() ), _x( 'says:', 'e.g. Bob says hello.', 'bgbn' ) ); ?>
    comment_approved ) : ?>

    'div-comment', 'depth' => $depth, 'max_depth' => $args['max_depth'], 'before' => '
    ', 'after' => '
    ', ) ) ); ?>
    1, ) ); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'all_the_cool_cats', $all_the_cool_cats, DAY_IN_SECONDS ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so bgbn_categorized_blog should return true. return true; } else { // This blog has only 1 category so bgbn_categorized_blog should return false. return false; } } endif; if ( ! function_exists( 'bgbn_category_transient_flusher' ) ) : /** * Flush out the transients used in bgbn_categorized_blog. * * @since 1.0.0. * * @return void */ function bgbn_category_transient_flusher() { delete_transient( 'all_the_cool_cats' ); bgbn_categorized_blog(); } endif; add_action( 'edit_category', 'bgbn_category_transient_flusher' ); add_action( 'save_post', 'bgbn_category_transient_flusher' ); if ( ! function_exists( 'bgbn_get_read_more' ) ) : /** * Return a read more link * * Use '%s' as a placeholder for the post URL. * * @since 1.0.0. * * @param string $before HTML before the text. * @param string $after HTML after the text. * @return string Full read more HTML. */ function bgbn_get_read_more( $before = '', $after = '' ) { if ( strpos( $before, '%s' ) ) { $before = sprintf( $before, get_permalink() ); } $more = apply_filters( 'bgbn_read_more_text', __( 'Read more', 'bgbn' ) ); return $before . $more . $after; } endif; if ( ! function_exists( 'bgbn_maybe_show_site_region' ) ) : /** * Output the site region (header or footer) markup if the current view calls for it. * * @since 1.0.0. * * @param string $region Region to maybe show. * @return void */ function bgbn_maybe_show_site_region( $region ) { if ( ! in_array( $region, array( 'header', 'footer' ) ) ) { return; } // Get the view $view = bgbn_get_view(); // Get the relevant option $hide_region = (bool) get_theme_mod( 'layout-' . $view . '-hide-' . $region, bgbn_get_default( 'layout-' . $view . '-hide-' . $region ) ); if ( true !== $hide_region ) { get_template_part( 'partials/' . $region . '-layout', get_theme_mod( $region . '-layout', bgbn_get_default( $region . '-layout' ) ) ); } } endif; if ( ! function_exists( 'bgbn_get_site_header_class' ) ) : /** * Compile the classes for the site header * * @since 1.0.0. * * @return string */ function bgbn_get_site_header_class() { // Base $class = 'site-header'; // Layout $class .= ' header-layout-' . get_theme_mod( 'header-layout', bgbn_get_default( 'header-layout' ) ); // Title $hide_site_title = (int) get_theme_mod( 'hide-site-title', bgbn_get_default( 'hide-site-title' ) ); if ( 1 === $hide_site_title || ! get_bloginfo( 'name' ) ) { $class .= ' no-site-title'; } // Tagline $hide_tagline = (int) get_theme_mod( 'hide-tagline', bgbn_get_default( 'hide-tagline' ) ); if ( 1 === $hide_tagline || ! get_bloginfo( 'description' ) ) { $class .= ' no-site-tagline'; } return esc_attr( $class ); } endif; if ( ! function_exists( 'bgbn_maybe_show_sidebar' ) ) : /** * Output the sidebar markup if the current view calls for it. * * The function is a wrapper for the get_sidebar() function. In this theme, the sidebars can be turned on and off for * different page views. It is important the the sidebar is *only included* if the user has set the option for it to * be included. As such, the get_sidebar() function needs to additional logic to determine whether or not to even * include the template. * * @since 1.0.0. * * @param string $location The sidebar location (e.g., left, right). * @return void */ function bgbn_maybe_show_sidebar( $location ) { // Get sidebar status $show_sidebar = bgbn_has_sidebar( $location ); // Output the sidebar if ( true === $show_sidebar ) { get_sidebar( $location ); } } endif; if ( ! function_exists( 'bgbn_maybe_show_social_links' ) ) : /** * Show the social links markup if the theme options and/or menus are configured for it. * * @since 1.0.0. * * @param string $region The site region (header or footer). * @return void */ function bgbn_maybe_show_social_links( $region ) { if ( ! in_array( $region, array( 'header', 'footer' ) ) ) { return; } $show_social = (bool) get_theme_mod( $region . '-show-social', bgbn_get_default( $region . '-show-social' ) ); if ( true === $show_social ) { // First look for the alternate custom menu method if ( has_nav_menu( 'social' ) ) { wp_nav_menu( array( 'theme_location' => 'social', 'container' => false, 'menu_id' => '', 'menu_class' => 'social-menu social-links ' . $region . '-social-links', 'depth' => 1, 'fallback_cb' => '', ) ); } // Then look for the Customizer theme option method else { $social_links = bgbn_get_social_links(); if ( ! empty( $social_links ) ) { ?> theme_location || 'social' !== $args->theme_location ) { return $output; } // Get the menu object $locations = get_nav_menu_locations(); $menu = wp_get_nav_menu_object( $locations[ $args->theme_location ] ); if ( ! $menu || is_wp_error( $menu ) ) { return $output; } $output = ''; // Get the menu items $menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) ); // Set up the $menu_item variables _wp_menu_item_classes_by_context( $menu_items ); // Sort the menu items $sorted_menu_items = array(); foreach ( (array) $menu_items as $menu_item ) { $sorted_menu_items[ $menu_item->menu_order ] = $menu_item; } unset( $menu_items, $menu_item ); // Supported social icons (filterable); [css class] => [url pattern] $supported_icons = apply_filters( 'bgbn_supported_social_icons', array( 'fa-adn' => 'app.net', 'fa-bitbucket' => 'bitbucket.org', 'fa-dribbble' => 'dribbble.com', 'fa-facebook' => 'facebook.com', 'fa-flickr' => 'flickr.com', 'fa-foursquare' => 'foursquare.com', 'fa-github' => 'github.com', 'fa-gittip' => 'gittip.com', 'fa-google-plus-square' => 'plus.google.com', 'fa-instagram' => 'instagram.com', 'fa-linkedin' => 'linkedin.com', 'fa-pinterest' => 'pinterest.com', 'fa-renren' => 'renren.com', 'fa-stack-exchange' => 'stackexchange.com', 'fa-stack-overflow' => 'stackoverflow.com', 'fa-trello' => 'trello.com', 'fa-tumblr' => 'tumblr.com', 'fa-twitter' => 'twitter.com', 'fa-vimeo-square' => 'vimeo.com', 'fa-vk' => 'vk.com', 'fa-weibo' => 'weibo.com', 'fa-xing' => 'xing.com', 'fa-youtube' => 'youtube.com', ) ); // Process each menu item foreach ( $sorted_menu_items as $item ) { $item_output = ''; // Look for matching icons foreach ( $supported_icons as $class => $pattern ) { if ( false !== strpos( $item->url, $pattern ) ) { $item_output .= '
  • '; $item_output .= ''; $item_output .= ''; $item_output .= '
  • '; break; } } // No matching icons if ( '' === $item_output ) { $item_output .= ''; } // Add item to list $output .= $item_output; unset( $item_output ); } // If there are menu items, add a wrapper if ( '' !== $output ) { $output = ''; } return $output; } endif; add_filter( 'pre_wp_nav_menu', 'bgbn_pre_wp_nav_menu_social', 10, 2 ); if ( ! function_exists( 'bgbn_get_exif_data' ) ) : /** * Get EXIF data from an attachment. * * @since 1.0.0. * * @param int $attachment_id The attachment ID to get data from. * @return string The EXIF data. */ function bgbn_get_exif_data( $attachment_id = 0 ) { // Validate attachment id if ( 0 === absint( $attachment_id ) ) { $attachment_id = get_post()->ID; } $output = ''; $attachment_meta = wp_get_attachment_metadata( $attachment_id ); $image_meta = ( isset( $attachment_meta['image_meta'] ) ) ? array_filter( $attachment_meta['image_meta'], 'trim' ) : array(); if ( ! empty( $image_meta ) ) { // Defaults $defaults = array( 'aperture' => 0, 'camera' => '', 'created_timestamp' => 0, 'focal_length' => 0, 'iso' => 0, 'shutter_speed' => 0, ); $image_meta = wp_parse_args( $image_meta, $defaults ); // Convert the shutter speed to a fraction and add units if ( 0 !== $image_meta[ 'shutter_speed' ] ) { $raw_ss = floatval( $image_meta['shutter_speed'] ); $denominator = 1 / $raw_ss; if ( $denominator > 1 ) { $decimal_places = 0; if ( in_array( number_format( $denominator, 1 ), array( 1.3, 1.5, 1.6, 2.5 ) ) ) { $decimal_places = 1; } $converted_ss = sprintf( '1/%1$s %2$s', number_format_i18n( $denominator, $decimal_places ), _x( 'second', 'time', 'bgbn' ) ); } else { $converted_ss = sprintf( '%1$s %2$s', number_format_i18n( $raw_ss, 1 ), _x( 'seconds', 'time', 'bgbn' ) ); } $image_meta['shutter_speed'] = apply_filters( 'bgbn_exif_shutter_speed', $converted_ss, $image_meta['shutter_speed'] ); } // Convert the aperture to an F-stop if ( 0 !== $image_meta[ 'aperture' ] ) { $f_stop = sprintf( '%1$s' . '%2$s', _x( 'f/', 'camera f-stop', 'bgbn' ), number_format_i18n( pow( sqrt( 2 ), absint( $image_meta['aperture'] ) ) ) ); $image_meta['aperture'] = apply_filters( 'bgbn_exif_aperture', $f_stop, $image_meta['aperture'] ); } $output .= "\n"; } return $output; } endif;