100, 'width' => 200, 'flex-height' => true, 'flex-width' => true, ) ); } add_action( 'after_setup_theme', 'wpbo_theme_settings_functions', 11 ); /**** THEME BLOCKS ***/ function wpbo_preheader() { ?> class="no-js"> 'sidebar1', 'name' => __('Main Sidebar','wpbo'), 'before_widget' => '
', 'description' => __('Used on every page BUT the homepage page template.','wpbo'), 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar2', 'name' => __('Homepage Sidebar','wpbo'), 'description' => __('Used only on the homepage page template.','wpbo'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar-contact', 'name' => __('Contact Page Sidebar','wpbo'), 'description' => __('Used only on the homepage page template.','wpbo'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'footer1', 'name' => __('Footer 1','wpbo'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'footer2', 'name' => __('Footer 2','wpbo'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'footer3', 'name' => __('Footer 3','wpbo'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); } // don't remove this bracket! /************* COMMENT LAYOUT *********************/ // Comment Layout if ( ! function_exists( 'wpbo_bootstrap_comments' ) ) : function wpbo_bootstrap_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?>
  • >
    %s', get_comment_author_link()) ?> ','') ?> comment_approved == '0') : ?>

    $depth, 'max_depth' => $args['max_depth']))) ?>
  •   str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'prev_next' => false, 'type' => 'array', 'prev_next' => TRUE, 'prev_text' => '', 'next_text' => '', ) ); if( is_array( $pages ) ) { $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); echo ''; } } endif; /************* SEARCH FORM LAYOUT *****************/ /****************** password protected post form *****/ add_filter( 'the_password_form', 'wpbo_custom_password_form' ); if ( ! function_exists( 'wpbo_custom_password_form' ) ) : function wpbo_custom_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '
    ' . '

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

    ' . '
    '; return $o; } endif; /*********** update standard wp tag cloud widget so it looks better ************/ add_filter( 'widget_tag_cloud_args', 'wpbo_my_widget_tag_cloud_args' ); if ( ! function_exists( 'wpbo_my_widget_tag_cloud_args' ) ) : function wpbo_my_widget_tag_cloud_args( $args ) { $args['number'] = 20; // show less tags $args['largest'] = 9.75; // make largest and smallest the same - i don't like the varying font-size look $args['smallest'] = 9.75; $args['unit'] = 'px'; return $args; } endif; // filter tag clould output so that it can be styled by CSS if ( ! function_exists( 'wpbo_add_tag_class' ) ) : function wpbo_add_tag_class( $taglinks ) { $tags = explode('', $taglinks); $regex = "#(.*tag-link[-])(.*)(' title.*)#e"; foreach( $tags as $tag ) { $tagn[] = preg_replace($regex, "('$1$2 label tag-'.get_tag($2)->slug.'$3')", $tag ); } $taglinks = implode('', $tagn); return $taglinks; } endif; add_action( 'wp_tag_cloud', 'wpbo_add_tag_class' ); add_filter( 'wp_tag_cloud','wpbo_tag_cloud_filter', 10, 2) ; if ( ! function_exists( 'wpbo_tag_cloud_filter' ) ) : function wpbo_tag_cloud_filter( $return, $args ) { return '
    ' . $return . '
    '; } endif; // Enable shortcodes in widgets add_filter( 'widget_text', 'do_shortcode' ); // Disable jump in 'read more' link if ( ! function_exists( 'wpbo_remove_more_jump_link' ) ) : function wpbo_remove_more_jump_link( $link ) { $offset = strpos($link, '#more-'); if ( $offset ) { $end = strpos( $link, '"',$offset ); } if ( $end ) { $link = substr_replace( $link, '', $offset, $end-$offset ); } return $link; } endif; add_filter( 'the_content_more_link', 'wpbo_remove_more_jump_link' ); // Remove height/width attributes on images so they can be responsive add_filter( 'post_thumbnail_html', 'wpbo_remove_thumbnail_dimensions', 10 ); add_filter( 'image_send_to_editor', 'wpbo_remove_thumbnail_dimensions', 10 ); if ( ! function_exists( 'wpbo_remove_thumbnail_dimensions' ) ) : function wpbo_remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; } endif; // Add the Meta Box to the homepage template if ( ! function_exists( 'wpbo_add_homepage_meta_box' ) ) : function wpbo_add_homepage_meta_box() { global $post; // Only add homepage meta box if template being used is the homepage template // $post_id = isset($_GET['post']) ? $_GET['post'] : (isset($_POST['post_ID']) ? $_POST['post_ID'] : ""); $post_id = $post->ID; $template_file = get_post_meta($post_id,'_wp_page_template',TRUE); if ( $template_file == 'page-homepage.php' ){ add_meta_box( 'homepage_meta_box', // $id 'Optional Homepage Tagline', // $title 'wpbo_show_homepage_meta_box', // $callback 'page', // $page 'normal', // $context 'high'); // $priority } } endif; add_action( 'add_meta_boxes', 'wpbo_add_homepage_meta_box' ); // Field Array $prefix = 'custom_'; $wpbo_custom_meta_fields = array( array( 'label'=> __('Homepage tagline area','wpbo'), 'desc' => __('Displayed underneath page title. Only used on homepage template. HTML can be used.','wpbo'), 'id' => $prefix.'tagline', 'type' => 'textarea' ) ); // The Homepage Meta Box Callback if ( ! function_exists( 'wpbo_show_homepage_meta_box' ) ) : function wpbo_show_homepage_meta_box() { global $wpbo_custom_meta_fields, $post; // Use nonce for verification wp_nonce_field( basename( __FILE__ ), 'wpbs_nonce' ); // Begin the field table and loop echo ''; foreach ( $wpbo_custom_meta_fields as $field ) { // get value of this field if it exists for this post $meta = get_post_meta($post->ID, $field['id'], true); // begin a table row with echo ''; } // end foreach echo '
    '; switch($field['type']) { // text case 'text': echo '
    '.$field['desc'].''; break; // textarea case 'textarea': echo '
    '.$field['desc'].''; break; } //end switch echo '
    '; // end table } endif; // Save the Data if ( ! function_exists( 'wpbo_save_homepage_meta' ) ) : function wpbo_save_homepage_meta( $post_id ) { global $wpbo_custom_meta_fields; // verify nonce if ( !isset( $_POST['wpbs_nonce'] ) || !wp_verify_nonce($_POST['wpbs_nonce'], basename(__FILE__)) ) return $post_id; // check autosave if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; // check permissions if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id ) ) return $post_id; } elseif ( !current_user_can( 'edit_post', $post_id ) ) { return $post_id; } // loop through fields and save the data foreach ( $wpbo_custom_meta_fields as $field ) { $old = get_post_meta( $post_id, $field['id'], true ); $new = $_POST[$field['id']]; if ($new && $new != $old) { update_post_meta( $post_id, $field['id'], $new ); } elseif ( '' == $new && $old ) { delete_post_meta( $post_id, $field['id'], $old ); } } // end foreach } endif; add_action( 'save_post', 'wpbo_save_homepage_meta' ); // Add thumbnail class to thumbnail links if ( ! function_exists( 'wpbo_add_class_attachment_link' ) ) : function wpbo_add_class_attachment_link( $html ) { $postid = get_the_ID(); $html = str_replace( ']+)?>/', '', $content, 1); } add_filter( 'the_content', 'wpbo_first_paragraph' ); } // Menu output mods class Bootstrap_walker extends Walker_Nav_Menu{ function start_el(&$output, $object, $depth = 0, $args = Array(), $current_object_id = 0){ global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; // If the item has children, add the dropdown class for bootstrap if ( $args->has_children ) { $class_names = "dropdown "; } $classes = empty( $object->classes ) ? array() : (array) $object->classes; $class_names .= join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $object ) ); $class_names = ' class="'. esc_attr( $class_names ) . '"'; $output .= $indent . '