'primary', 'name' => _x( 'Primary', 'sidebar', 'inception' ), 'description' => __( 'Main Sidebar used in both two column and three column layout. Generally present in Right section.', 'inception' ) ) ); hybrid_register_sidebar( array( 'id' => 'secondary', 'name' => _x( 'Secondary', 'sidebar', 'inception' ), 'description' => __( 'Secondary Sidebar used in three column layout only.', 'inception' ) ) ); hybrid_register_sidebar( array( 'id' => 'subsidiary', 'name' => _x( 'Subsidiary', 'sidebar', 'inception' ), 'description' => __( 'Footer Sidebar. Optimized for one, two and three column layout.', 'inception' ) ) ); } /** * Load scripts for the front end. * * @since 1.0.0 * @access public * @return void */ function inception_enqueue_scripts() { $suffix = hybrid_get_min_suffix(); wp_register_script( 'inception', trailingslashit( get_template_directory_uri() ) . "js/theme{$suffix}.js", array( 'jquery' ), null, true ); wp_enqueue_script( 'inception' ); } /** * Load stylesheets for the front end. * * @since 1.0.0 * @access public * @return void */ function inception_enqueue_styles() { /* Gets ".min" suffix. */ $suffix = hybrid_get_min_suffix(); /* Load one-five base style. */ if ( current_theme_supports( 'one-five' ) ) { wp_enqueue_style( 'one-five', trailingslashit( HYBRID_CSS ) . "one-five{$suffix}.css" ); } /* Load gallery style if 'cleaner-gallery' is active. */ if ( current_theme_supports( 'cleaner-gallery' ) ) { wp_enqueue_style( 'gallery', trailingslashit( HYBRID_CSS ) . "gallery{$suffix}.css" ); } /* Load parent theme stylesheet if child theme is active. */ if ( is_child_theme() ) { wp_enqueue_style( 'parent', trailingslashit( get_template_directory_uri() ) . "style{$suffix}.css" ); } /* Load active theme stylesheet. */ wp_enqueue_style( 'style', get_stylesheet_uri() ); } /** * Adds a custom excerpt length. * * @since 1.0.0 * @access public * @param int $length * @return int */ function inception_excerpt_length( $length ) { return 30; } /** * Removes the [..] sign/symbol for excerpt. * * @since 1.0.0 * @access public * @param string $text * @return string */ function trim_excerpt($text) { return rtrim($text,'[...]'); } add_filter('get_the_excerpt', 'trim_excerpt'); /** * Adds a custom class to the 'footer' sidebar. This is used to determine the number of columns used to * display the sidebar's widgets. This optimizes for 1, 2, and 3 columns or multiples of those values. * * Note that we're using the global $sidebars_widgets variable here. This is because core has marked * wp_get_sidebars_widgets() as a private function. Therefore, this leaves us with $sidebars_widgets for * figuring out the widget count. * @link http://codex.wordpress.org/Function_Reference/wp_get_sidebars_widgets * * @since 1.0.0 * @access public * @param array $attr * @param string $context * @return array */ function inception_sidebar_footer_class( $attr, $context ) { if ( 'subsidiary' === $context ) { global $sidebars_widgets; if ( is_array( $sidebars_widgets ) && !empty( $sidebars_widgets[ $context ] ) ) { $count = count( $sidebars_widgets[ $context ] ); if ( 1 === $count ) $attr['class'] .= ' sidebar-col-1'; elseif ( !( $count % 3 ) || $count % 2 ) $attr['class'] .= ' sidebar-col-3'; elseif ( !( $count % 2 ) ) $attr['class'] .= ' sidebar-col-2'; } } return $attr; } /** * Turns the IDs into classes for the calendar. * * @since 1.0.0 * @access public * @param string $calendar * @return string */ function inception_get_calendar( $calendar ) { return preg_replace( '/id=([\'"].*?[\'"])/i', 'class=$1', $calendar ); } /** * Checks the values of theme_mod andd metabox to generate class for the main section. * * @since 1.0.0 */ function inception_main_layout_class() { $layout_global = get_theme_mod('inception_sidebar','content-sidebar'); if(is_singular()){ $layout = get_post_meta( get_the_ID(), 'inception_sidebarlayout', 'default', true ); if(($layout == "default") || (empty($layout))){ $layout = $layout_global; } } else { $layout = $layout_global; } /* Adds class according to the sidebar layout */ if ($layout == "sidebar-content" || $layout == "content-sidebar") { echo "col-md-8"; } elseif ($layout == "full-width"){ echo "col-md-12"; } else { echo "col-md-6"; } } /** * Checks the values of theme_mod andd metabox to generate class for the main section. * * @since 1.0.0 */ function inception_sidebar_layout_class() { $layout_global = get_theme_mod('inception_sidebar','content-sidebar'); if(is_singular()){ $layout = get_post_meta( get_the_ID(), 'inception_sidebarlayout', 'default', true ); if(($layout == "default") || (empty($layout))){ $layout = $layout_global; } } else { $layout = $layout_global; } /* Adds class according to the sidebar layout */ if ($layout == "sidebar-content" || $layout == "content-sidebar") { echo "col-md-4"; } else { echo "col-md-3"; } } /** * Add Bootstrap thumbnail styling to images with captions * Use
and
* * @since 1.0.0 * @link http://justintadlock.com/archives/2011/07/01/captions-in-wordpress */ function inception_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; } /** * Handles the array for wp_nav_menu mobile menu * * @since 1.0.0 */ function inception_select_mobile_nav_menu() { $mobnav = wp_nav_menu(array( 'container' => false, // remove nav container 'container_class' => 'menu clearfix', // class of container (should you choose to use it) 'menu_class' => 'clearfix', // adding custom nav class 'theme_location' => 'primary', // where it's located in the theme 'before' => '', 'echo' => false, // echo 'after' => '', // after the menu 'link_before' => '', // before each link 'link_after' => '', // after each link 'depth' => 3, // limit the depth of the nav 'items_wrap' => '', 'walker' => new select_mobile_Walker_Nav_Menu(), // 'show_home' => true, 'fallback_cb' => 'eo_mobile_nav_fallback' // fallback function )); echo strip_tags($mobnav, '
' ); } ?>