Forbidden'; exit(); } /******************************************************************************* * Theme Support Options to be initialized */ add_editor_style(); add_theme_support( 'custom-background'); add_theme_support( 'automatic-feed-links' ); add_filter('show_admin_bar', '__return_false'); /******************************************************************************* * Content Width to be initialized if not already set */ if ( ! isset( $content_width ) ) $content_width = 600; /******************************************************************************* * Register widgetized sidebars and nav_menu */ if (function_exists('register_sidebar')) { // Register sidebar register_sidebar(array( 'name' => "sidebar", 'description' => __('Bootstrap Widgetized', 'bootstrap'), 'before_widget' => '
', 'before_title' => '
', 'after_title' => '
', 'after_widget' => '
')); // Register Nav Menu register_nav_menu( 'primary', 'Bootstrap nav menu' ); } /******************************************************************************* * Function called from header.php to load all theme scripts and styles */ function boot_load_theme_styles_scripts () { // Enqueue bootstrap js scripts wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array( 'jquery' ) ); // Enqueue bootstrap css styles wp_enqueue_style('bootstrap-min-css', get_template_directory_uri() . '/assets/bootstrap/css/bootstrap.min.css', array() ); wp_enqueue_style('bootstrap-glyphions-css', get_template_directory_uri() . '/assets/bootstrap/css/bootstrap-glyphicons.css', array() ); wp_enqueue_style('custom-style-css', get_template_directory_uri() . '/assets/css/customStyle.css', array() ); } /******************************************************************************* * Filter to lower the context to a summary length for archive templates only */ add_filter('the_content', 'trim_content'); function trim_content($content){ if(is_archive()){ //use your own trick to get the first 50 words. I'm getting the first 200 characters just to show an example. $more = (strlen($content) <= 500) ? "" : " [...] "; $content = '

' . wp_html_excerpt($content, 500) . $more . '

'; } return $content; } /******************************************************************************* * Filter to lower the context to a summary length for archive templates only */ function the_titlesmall($before = '', $after = '', $echo = true, $length = false) { $title = get_the_title(); if ( $length && is_numeric($length) ) { $title = substr( $title, 0, $length ); } if ( strlen($title)> 0 ) { $title = apply_filters('the_titlesmall', $before . $title . $after, $before, $after); if ( $echo ) { echo $title; } else { echo $title; } } else { echo "Untitled-Entry"; } } /******************************************************************************* * Template for comments and pingbacks */ if ( ! function_exists( 'bootstrap_comment' ) ) { function bootstrap_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    ', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'bootstrap' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. $utility_text = ''; if ( $tag_list ) { $utility_text .= __( 'This entry was posted in %1$s and tagged %2$s on %3$s by %4$s.', 'bootstrap' ); } elseif ( $categories_list ) { $utility_text .= __( 'This entry was posted in %1$s on %3$s by %4$s.', 'bootstrap' ); } else { $utility_text .= __( 'This entry was posted on %3$s by %4$s.', 'bootstrap' ); } $utility_text .= ''; printf( $utility_text, $categories_list, $tag_list, $date, $author ); } } /** * Create HTML list of nav menu items. * */ class bootstrap_walker extends Walker { /** * @see Walker::$tree_type * @since 3.0.0 * @var string */ var $tree_type = array( 'post_type', 'taxonomy', 'custom' ); /** * @see Walker::$db_fields * @since 3.0.0 * @todo Decouple this. * @var array */ var $db_fields = array( 'parent' => 'menu_item_parent', 'id' => 'db_id' ); function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) { $id_field = $this->db_fields['id']; if ( is_object( $args[0] ) ) { $args[0]->has_children = ! empty( $children_elements[$element->$id_field] ); } return parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); } /** * @see Walker::start_lvl() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of page. Used for padding. */ function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent\n"; } /** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param int $current_page Menu item ID. * @param object $args */ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; if ( $args->has_children && $depth==0) { $classes[] = 'dropdown'; } $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); if ($class_names) { $class_names = ' class="' . esc_attr( $class_names ); } else { $class_names = ''; } $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $atts = array(); $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; $atts['target'] = ! empty( $item->target ) ? $item->target : ''; $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; $atts['href'] = ! empty( $item->url ) ? $item->url : ''; $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { if($args->has_children && $depth == 0){ $value = '#'; $attributes .= ' ' . $attr . '="' . $value . '" class="dropdown-toggle" data-toggle="dropdown"'; } else { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } } $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; if ($args->has_children && $depth==0 ){ $item_output .= ''; } $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } /** * @see Walker::end_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Page data object. Not used. * @param int $depth Depth of page. Not Used. */ function end_el( &$output, $item, $depth = 0, $args = array() ) { $output .= "
  • \n"; } }