"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' => '
", 'before_title' => '
__('Reply ↓', 'bootstrapwp'), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) )); ?>
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 = '"; 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 .= ' '; 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"; } }