ID ) ? rand() : $post->ID ); $o = '

' . esc_html__( "This post is password protected. To view it please enter your password below:" ,'shapely') . '

'; return $o; } // Add Bootstrap classes for table add_filter( 'the_content', 'shapely_add_custom_table_class' ); function shapely_add_custom_table_class( $content ) { return preg_replace( '/(]*)class="([^"]*)")?/', '$1 $3 class="$4 table table-hover" ', $content); } if ( ! function_exists( 'shapely_header_menu' ) ) : /** * Header menu (should you choose to use one) */ function shapely_header_menu() { // display the WordPress Custom Menu if available wp_nav_menu(array( 'menu' => 'primary', 'menu_id' => 'menu', 'theme_location' => 'primary', 'depth' => 3, 'container' => 'div', 'container_class' => 'collapse navbar-collapse navbar-ex1-collapse', 'menu_class' => 'menu', 'fallback_cb' => 'wp_bootstrap_navwalker::fallback', 'walker' => new wp_bootstrap_navwalker() )); } /* end header menu */ endif; /** * function to show the footer info, copyright information */ function shapely_footer_info() { printf( esc_html__( 'Theme by %1$s Powered by %2$s', 'shapely' ) , 'Colorlib', 'WordPress'); } if ( ! function_exists( 'get_shapely_theme_options' ) ) { /** * Get information from Theme Options and add it into wp_head */ function get_shapely_theme_options(){ echo ''; } } add_action( 'wp_head', 'get_shapely_theme_options', 10 ); /** * Add Bootstrap thumbnail styling to images with captions * Use
and
* * @link http://justintadlock.com/archives/2011/07/01/captions-in-wordpress */ function shapely_caption($output, $attr, $content) { if (is_feed()) { return $output; } $defaults = array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ); $attr = shortcode_atts($defaults, $attr); // If the width is less than 1 or there is no caption, return the content wrapped between the [caption] tags if ($attr['width'] < 1 || empty($attr['caption'])) { return $content; } // Set up the attributes for the caption
$attributes = (!empty($attr['id']) ? ' id="' . esc_attr($attr['id']) . '"' : '' ); $attributes .= ' class="thumbnail wp-caption ' . esc_attr($attr['align']) . '"'; $attributes .= ' style="width: ' . (esc_attr($attr['width']) + 10) . 'px"'; $output = ''; $output .= do_shortcode($content); $output .= '
' . $attr['caption'] . '
'; $output .= '
'; return $output; } add_filter('img_caption_shortcode', 'shapely_caption', 10, 3); /** * Skype URI support for social media icons */ function shapely_allow_skype_protocol( $protocols ){ $protocols[] = 'skype'; return $protocols; } add_filter( 'kses_allowed_protocols' , 'shapely_allow_skype_protocol' ); /** * Adds the URL to the top level navigation menu item */ function shapely_add_top_level_menu_url( $atts, $item, $args ){ if ( !wp_is_mobile() && isset($args->has_children) && $args->has_children ) { $atts['href'] = ! empty( $item->url ) ? $item->url : ''; } return $atts; } add_filter( 'nav_menu_link_attributes', 'shapely_add_top_level_menu_url', 99, 3 ); /** * Makes the top level navigation menu item clickable */ function shapely_make_top_level_menu_clickable(){ if ( !wp_is_mobile() ) { ?> '.esc_html_x( 'Read More', 'Read More', 'shapely' ).''; } add_filter('excerpt_more', 'shapely_excerpt_more'); /* * Pagination */ if( !function_exists('shapely_pagination') ){ function shapely_pagination($pages = '', $range = 2){ global $paged; $showitems = ( $range * 2 )+1; if( empty( $paged) ) $paged = 1; if($pages == ''){ global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages){ $pages = 1; } } if(1 != $pages) { echo "
    "; //if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "« First"; if($paged > 1 && $showitems < $pages) echo "«"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )){ echo ($paged == $i)? "
  • ".$i."
  • ":"
  • ".$i."
  • "; } } if ($paged < $pages && $showitems < $pages) echo "
  • »
  • "; //if ($paged < ($pages-1) && ( $paged+$range-1 < $pages ) && $showitems < $pages) echo 'Last »'; echo "
\n"; } }} /* * Search Widget */ function shapely_search_form( $form ) { $form = ''; return $form; } add_filter( 'get_search_form', 'shapely_search_form', 100 ); /* * Admin Css */ function shapely_admin_style() { echo ''; } add_action('admin_head', 'shapely_admin_style'); add_action('customize_controls_print_styles', 'shapely_admin_style'); /* Social Fields in Author Profile */ if( !function_exists('shapely_author_socialLinks') ){ function shapely_author_socialLinks( $contactmethods ) { // Add Twitter $contactmethods['twitter'] = 'Twitter'; //add Facebook $contactmethods['facebook'] = 'Facebook'; //add Github $contactmethods['github'] = 'Github'; //add Dribble $contactmethods['dribble'] = 'Dribble'; //add Vimeo $contactmethods['vimeo'] = 'Vimeo'; return $contactmethods; } } add_filter('user_contactmethods','shapely_author_socialLinks',10,1); /* * Author bio on single page */ if( !function_exists('shapely_author_bio') ){ function shapely_author_bio(){ if( !get_the_ID() ) return; $author_fields = "'user_url','display_name', 'nickname', 'first_name','last_name','description', 'ID'"; $author_displayname = get_the_author_meta('display_name'); $author_nickname = get_the_author_meta('nickname'); $author_fullname = ( get_the_author_meta('first_name') != "" && get_the_author_meta('last_name') != "" ) ? get_the_author_meta('first_name')." ".get_the_author_meta('last_name') : ""; $author_url = get_the_author_meta('user_url'); $author_description = get_the_author_meta('description'); $author_name = ( trim( $author_nickname ) != "" ) ? $author_nickname : ( trim( $author_displayname ) != "" ) ? $author_displayname : $author_fullname ?>
  • id="comment-">
    $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> comment_approved == '0' ) : ?>


  • '', 'email' => '', 'url' => '', ); $comments_args = array( 'label_submit' => __( 'Leave Comment', 'shapely' ), 'comment_field' => '', 'fields' => apply_filters( 'comment_form_default_fields', $fields ) ); return $comments_args; } /* * Header Logo */ function shapely_get_header_logo(){ $logo_id = get_theme_mod('header_logo', ''); $logo = wp_get_attachment_image_src($logo_id, 'full'); ?>

    ID, 'site_layout', true) ){ $layout_class = get_post_meta($post->ID, 'site_layout', true); } else{ $layout_class = get_theme_mod( 'shapely_sidebar_position', 'side-right' ); } return $layout_class; } /* * Show Sidebar or not */ function shapely_show_sidebar(){ global $post; $show_sidebar = true; if( is_singular() && ( get_post_meta($post->ID, 'site_layout', true) ) ){ if( get_post_meta($post->ID, 'site_layout', true) == 'no-sidebar' || get_post_meta($post->ID, 'site_layout', true) == 'full-width' ) { $show_sidebar = false; } } elseif( get_theme_mod( 'shapely_sidebar_position' ) == "no-sidebar" || get_theme_mod( 'shapely_sidebar_position' ) == "full-width" ) { $show_sidebar = false; } return $show_sidebar; } /* * Top Callout */ function shapely_top_callout(){ if( get_theme_mod('top_callout', true) ) { ?>

    ','

    '); } ?>
    ','

    '); ?>