"Main menu", )); // load custom walker menu class file } endif; add_action('after_setup_theme', 'bootstrapwp_theme_setup'); /** * Define post thumbnail size. * Add two additional image sizes. * */ function bootstrapwp_images() { set_post_thumbnail_size(260, 180); // 260px wide x 180px high add_image_size('bootstrap-small', 300, 200); // 300px wide x 200px high add_image_size('bootstrap-medium', 360, 270); // 360px wide by 270px high } /** * Load CSS styles for theme. * */ function bootstrapwp_styles_loader() { wp_enqueue_style('bootstrapwp-style', get_template_directory_uri() . '/assets/css/bootstrapwp.css', false, '1.0', 'all'); wp_enqueue_style('bootstrapwp-default', get_stylesheet_uri()); // registering scripts and styles for documentation templates wp_register_style('docs-css', get_template_directory_uri() . '/templates-documentation/assets/css/docs.css', array('bootstrapwp-style'), '2.3.2', 'all'); } add_action('wp_enqueue_scripts', 'bootstrapwp_styles_loader'); /** * Load JavaScript and jQuery files for theme. * */ function bootstrapwp_scripts_loader() { if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), '1.0', true); wp_enqueue_script('demo-js', get_template_directory_uri() . '/assets/js/bootstrapwp.demo.js', array('bootstrap-js'),'1.0',true); } add_action('wp_enqueue_scripts', 'bootstrapwp_scripts_loader'); /** * Define theme's widget areas. * */ function bootstrapwp_widgets_init() { register_sidebar( array( 'name' => __('Page Sidebar', 'bootstrapwp'), 'id' => 'sidebar-page', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __('Posts Sidebar', 'bootstrapwp'), 'id' => 'sidebar-posts', 'before_widget' => '
', 'after_widget' => "
", 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __('Home Left', 'bootstrapwp'), 'id' => 'home-left', 'description' => __('Left textbox on homepage', 'bootstrapwp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __('Home Middle', 'bootstrapwp'), 'id' => 'home-middle', 'description' => __('Middle textbox on homepage', 'bootstrapwp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __('Home Right', 'bootstrapwp'), 'id' => 'home-right', 'description' => __('Right textbox on homepage', 'bootstrapwp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __('Footer Content', 'bootstrapwp'), 'id' => 'footer-content', 'description' => __('Footer text or acknowledgements', 'bootstrapwp'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); } add_action('init', 'bootstrapwp_widgets_init'); /** * Display page next/previous navigation links. * */ if (!function_exists('bootstrapwp_content_nav')): function bootstrapwp_content_nav($nav_id) { global $wp_query, $post; if ($wp_query->max_num_pages > 1) : ?> comment_type) : case 'pingback' : case 'trackback' : ?>
  • %1$s %2$s', get_comment_author_link(), // If current post author is also comment author, make it known visually. ($comment->user_id === $post->post_author) ? ' ' . __( 'Post author', 'bootstrapwp' ) . ' ' : ''); ?>

    comment_approved) : ?>

    ', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), sprintf( __('%1$s at %2$s', 'bootstrapwp'), get_comment_date(), get_comment_time() ) ); ?>

    __('Reply ', 'bootstrapwp'), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) )); ?>

    by in %8$s','bootstrapwp'), esc_url(get_permalink()), esc_attr(get_the_time()), esc_attr(get_the_date('c')), esc_html(get_the_date()), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_attr(sprintf(__('View all posts by %s', 'bootstrapwp'), get_the_author())), esc_html(get_the_author()), strip_tags (get_the_category_list(", ")) ); the_tags("

    Tags: ", ", ", "

    "); } endif; /** * Adds custom classes to the array of body classes. * */ function bootstrapwp_body_classes($classes) { if (!is_multi_author()) { $classes[] = 'single-author'; } return $classes; } add_filter('body_class', 'bootstrapwp_body_classes'); /** * Add post ID attribute to image attachment pages prev/next navigation. * */ function bootstrapwp_enhanced_image_navigation($url) { global $post; if (wp_attachment_is_image($post->ID)) { $url = $url . '#main'; } return $url; } add_filter('attachment_link', 'bootstrapwp_enhanced_image_navigation'); /** * Checks if a post thumbnails is already defined. * */ function bootstrapwp_is_post_thumbnail_set() { global $post; if (get_the_post_thumbnail()) { return true; } else { return false; } } /** * Set post thumbnail as first image from post, if not already defined. * */ function bootstrapwp_autoset_featured_img() { global $post; $post_thumbnail = bootstrapwp_is_post_thumbnail_set(); if ($post_thumbnail == true) { return get_the_post_thumbnail(); } $image_args = array( 'post_type' => 'attachment', 'numberposts' => 1, 'post_mime_type' => 'image', 'post_parent' => $post->ID, 'order' => 'desc' ); $attached_images = get_children($image_args, ARRAY_A); $first_image = reset($attached_images); if (!$first_image) { return false; } return get_the_post_thumbnail($post->ID, $first_image['ID']); } /** * Define default page titles. * */ function bootstrapwp_wp_title($title, $sep) { global $paged, $page; if (is_feed()) { return $title; } // Add the site name. $title .= get_bloginfo('name'); // Add the site description for the home/front page. $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { $title = "$title $sep $site_description"; } // Add a page number if necessary. if ($paged >= 2 || $page >= 2) { $title = "$title $sep " . sprintf(__('Page %s', 'bootstrapwp'), max($paged, $page)); } return $title; } add_filter('wp_title', 'bootstrapwp_wp_title', 10, 2); /** * Display template for breadcrumbs. * */ function bootstrapwp_breadcrumbs() { $home = 'Home'; // text for the 'Home' link $before = '
  • '; // tag before the current crumb $sep = '/'; $after = '
  • '; // tag after the current crumb if (!is_home() && !is_front_page() || is_paged()) { echo ''; } } function show_socials() { $return=""; return $return; } //Featured posts slider add_action("admin_init", "selection_meta_box"); function selection_meta_box(){ //add_meta_box("featured-post", "Set Featured", "featured_post", "post", "side", "low"); Uncomment this line and comment the below foreach loop if you want the Set Featured option only for posts $post_types_array = get_post_types(); foreach ( $post_types_array as $post_type ) { add_meta_box("featured-post", "Set Featured", "featured_post", $post_type, "side", "low"); } } function featured_post(){ global $post; $meta_data = get_post_custom($post->ID); $featured_post = $meta_data["_featured_post"][0]; $selected = ($meta_data["_featured_post"][0] == "yes") ? 'checked' : ''; echo "

    "; echo ""; echo ""; echo "

    "; } add_action('save_post', 'save_post_details'); function save_post_details(){ global $post; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return; $featured_post = trim($_POST["featured_post"]); update_post_meta($post->ID, "_featured_post", $featured_post); } add_theme_support( 'post-thumbnails' ); if ( function_exists( 'add_image_size' ) ) { add_image_size( 'sliding-images', 1170, 400, true ); } function show_featured_posts($numbers) { global $post; $output=""; $featured_posts_array = get_posts( 'meta_key=_featured_post&meta_value=yes&numberposts=$numbers&post_status=publish'); $output .= '
    '; $output .="
    "; $output .= '
    '; $output .="
      "; foreach ($featured_posts_array as $post) : setup_postdata($post); $slidertitle = "#slide".get_the_ID(); //assign the postID as title of the image if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) { $output .= "
    • ".get_the_post_thumbnail(get_the_ID(), array(1170,400), array( "class" => "post_thumbnail", 'title' => $slidertitle )); } $caption = "

      ".get_the_title()."

      ".get_the_excerpt()."
      "; $output.=$caption; $output.="
    • "; endforeach; $output .= '
    '; $output .=""; $output .= '
    '; return $output; wp_reset_query(); } function include_flex_script() { wp_register_script( 'flex', get_template_directory_uri().'/assets/js/jquery.flex.min.js'); wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'flex' ); } add_action('wp_enqueue_scripts', 'include_flex_script'); add_action('wp_footer', 'flex_init'); function flex_init() { echo ''; } class Bootstrapwp_Walker_Nav_Menu extends Walker_Nav_Menu { /** * Opening tag for menu list before anything is added * * * @param array reference &$output Reference to class' $output * @param int $depth Depth of menu (if nested) * @param array $args Class args, unused here * * @return string $indent * @return array by-reference &$output * */ function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent\n"; } }