__('Top Left Menu', 'adsoft_language'), 'main_navi' => __('Main Menu', 'adsoft_language'), 'footermen' => __('Footer Menu', 'adsoft_language'), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); } endif; // Register Sidebars add_action( 'widgets_init', 'adsoft_widgets_init' ); function adsoft_widgets_init() { // Register Sidebars register_sidebar( array( 'name' => __( 'Main Sidebar', 'adsoft_language' ), 'id' => 'sidebar-main', 'description' => __( 'Appears on posts and also pages (in case Sidebar Pages has no widgets) except frontpage/fullwidth template.', 'adsoft_language' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Sidebar Pages', 'adsoft_language' ), 'id' => 'sidebar-pages', 'description' => __( 'Appears on static pages only. Leave this widget area empty to use Main Sidebar on pages.', 'adsoft_language' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar( array( 'name' => __( 'Header', 'adsoft_language' ), 'id' => 'sidebar-header', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Content', 'adsoft_language' ), 'id' => 'sidebar-content', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sub Footer 1', 'adsoft_language' ), 'id' => 'sidebar-ft1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sub Footer 2', 'adsoft_language' ), 'id' => 'sidebar-ft2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sub Footer 3', 'adsoft_language' ), 'id' => 'sidebar-ft3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Sub Footer 4', 'adsoft_language' ), 'id' => 'sidebar-ft4', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } /*==================================== INCLUDE FILES ====================================*/ // Includes all files needed for theme options, custom JS/CSS and Widgets // include Theme Option Files require( get_template_directory() . '/includes/options/options-setup.php' ); require( get_template_directory() . '/includes/options/options-framework.php' ); // include Customization Files require( get_template_directory() . '/includes/customization/custom-colors.php' ); require( get_template_directory() . '/includes/customization/fonts.css.php' ); require( get_template_directory() . '/includes/customization/custom-layout.php' ); require( get_template_directory() . '/includes/customization/custom-jscript.php' ); // include Hooks, Template Tags and extra Features of the theme require( get_template_directory() . '/includes/template-tags.php' ); require( get_template_directory() . '/includes/theme-hooks.php' ); require( get_template_directory() . '/includes/custom-widgets.php' ); /*==================================== THEME FUNCTIONS ====================================*/ /** * Count the number of footer sidebars to enable dynamic classes for the footer * * @since adsoft 1.0 */ function adsoft_footer_sidebar_class() { $count = 0; if ( is_active_sidebar( 'sidebar-ft1' ) ) $count++; if ( is_active_sidebar( 'sidebar-ft2' ) ) $count++; if ( is_active_sidebar( 'sidebar-ft3' ) ) $count++; if ( is_active_sidebar( 'sidebar-ft4' ) ) $count++; $class = ''; switch ( $count ) { case '1': $class = 'container site-extra extra-one'; break; case '2': $class = 'container site-extra extra-two'; break; case '3': $class = 'container site-extra extra-three'; break; case '4': $class = 'container site-extra extra-four'; break; } if ( $class ) echo 'class="' . $class . '"'; } // Creates a better title element text for output in the head section add_filter( 'wp_title', 'adsoft_wp_title', 10, 2 ); function adsoft_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', 'adsoft_language' ), max( $paged, $page ) ); return $title; } // Add Default Menu Fallback Function function adsoft_default_menu() { echo ''; } function adsoft_footer_menu() { echo ''; } // Change Excerpt Length add_filter('excerpt_length', 'adsoft_excerpt_length'); function adsoft_excerpt_length($length) { return 50; } // Slideshow Excerpt Length function adsoft_slideshow_excerpt_length($length) { return 25; } // Frontpage Category Excerpt Length function adsoft_frontpage_category_excerpt_length($length) { return 13; } // Change Excerpt More add_filter('excerpt_more', 'adsoft_excerpt_more'); function adsoft_excerpt_more($more) { return ''; } // Add span widget title add_filter ( 'widget_title', 'adsoft_widget_title' ); function adsoft_widget_title( $old_title ) { $title = explode( " ", $old_title, 2 ); if ( isset( $title[0] ) && isset( $title[1] ) ) { $titleNew = "$title[0] $title[1]"; } else{ return; } return $titleNew; } // Display social networks if ( ! function_exists( 'adsoft_social_networks' ) ): function adsoft_social_networks() { $options = get_option('adsoft_options'); ?>
'post', 'post_status' => 'publish', 'ignore_sticky_posts' => true, 'posts_per_page' => 6, 'paged' => $paged, 'orderby' => 'date', 'order' => 'DESC', 'category_name' => $frontpage_posts_category ); $tux_frontpage_posts_query = new WP_Query($query_arguments); return $tux_frontpage_posts_query; } // Add icon parent menu class add_span_walker extends Walker_Nav_Menu { function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; if ( 'main_navi' == $args->theme_location ) { $submenus = 0 == $depth || 1 == $depth ? get_posts( array( 'post_type' => 'nav_menu_item', 'numberposts' => 1, 'meta_query' => array( array( 'key' => '_menu_item_menu_item_parent', 'value' => $item->ID, 'fields' => 'ids' ) ) ) ) : false; $item_output .= ! empty( $submenus ) ? ( 0 == $depth ? '' : '' ) : ''; } $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } // ADiable admin bar show_admin_bar(false); // Add Author Links function add_to_author_profile( $contactmethods ) { $contactmethods['rss_url'] = 'RSS URL'; $contactmethods['google_profile'] = 'Google Profile URL'; $contactmethods['twitter_profile'] = 'Twitter Profile URL'; $contactmethods['facebook_profile'] = 'Facebook Profile URL'; $contactmethods['youtube_profile'] = 'YouTube Profile URL'; $contactmethods['linkedin_profile'] = 'Linkedin Profile URL'; $contactmethods['pinterest_profile'] = 'Pinterest Profile URL'; $contactmethods['vimeo_profile'] = 'Vimeo Profile URL'; $contactmethods['flickr_profile'] = 'Flickr Profile URL'; $contactmethods['tumblr_profile'] = 'Tumblr Profile URL'; $contactmethods['instagram_profile'] = 'Instagram Profile URL'; $contactmethods['lastfm_profile'] = 'Last.fm Profile URL'; $contactmethods['soundcloud_profile'] = 'SoundCloud Profile URL'; return $contactmethods; } add_filter( 'user_contactmethods', 'add_to_author_profile', 10, 1); /** * Breadcrumb by zifana.com */ function adsoft_simplex_breadcrumbs() { /* === OPTIONS === */ $text['home'] = ''; // text for the 'Home' link $text['category'] = 'Archive by Category "%s"'; // text for a category page $text['search'] = 'Search Results for "%s" Query'; // text for a search results page $text['tag'] = 'Posts Tagged "%s"'; // text for a tag page $text['author'] = 'Articles Posted by %s'; // text for an author page $text['404'] = 'Error 404'; // text for the 404 page $showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show $showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $delimiter = ' '; // delimiter between crumbs $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb /* === END OF OPTIONS === */ global $post; $homeLink = home_url() . '/'; $linkBefore = ''; $linkAfter = ''; $linkAttr = ' rel="v:url" property="v:title"'; $link = $linkBefore . '%2$s' . $linkAfter; if (is_home() || is_front_page()) { if ($showOnHome == 1) echo ''; } else { echo '
' . sprintf($link, $homeLink, $text['home']) . $delimiter; if ( is_category() ) { $thisCat = get_category(get_query_var('cat'), false); if ($thisCat->parent != 0) { $cats = get_category_parents($thisCat->parent, TRUE, $delimiter); $cats = str_replace('', '' . $linkAfter, $cats); echo $cats; } echo $before . sprintf($text['category'], single_cat_title('', false)) . $after; } elseif ( is_search() ) { echo $before . sprintf($text['search'], get_search_query()) . $after; } elseif ( is_day() ) { echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter; echo sprintf($link, get_month_link(get_the_time('Y'),get_the_time('m')), get_the_time('F')) . $delimiter; echo $before . get_the_time('d') . $after; } elseif ( is_month() ) { echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter; echo $before . get_the_time('F') . $after; } elseif ( is_year() ) { echo $before . get_the_time('Y') . $after; } elseif ( is_single() && !is_attachment() ) { if ( get_post_type() != 'post' ) { $post_type = get_post_type_object(get_post_type()); $slug = $post_type->rewrite; printf($link, $homeLink . '/' . $slug['slug'] . '/', $post_type->labels->singular_name); if ($showCurrent == 1) echo $delimiter . $before . get_the_title() . $after; } else { $cat = get_the_category(); $cat = $cat[0]; $cats = get_category_parents($cat, TRUE, $delimiter); if ($showCurrent == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats); $cats = str_replace('', '' . $linkAfter, $cats); echo $cats; if ($showCurrent == 1) echo $before . get_the_title() . $after; } } elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) { $post_type = get_post_type_object(get_post_type()); echo $before . $post_type->labels->singular_name . $after; } elseif ( is_attachment() ) { $parent = get_post($post->post_parent); $cat = get_the_category($parent->ID); $cat = $cat[0]; $cats = get_category_parents($cat, TRUE, $delimiter); $cats = str_replace('', '' . $linkAfter, $cats); echo $cats; printf($link, get_permalink($parent), $parent->post_title); if ($showCurrent == 1) echo $delimiter . $before . get_the_title() . $after; } elseif ( is_page() && !$post->post_parent ) { if ($showCurrent == 1) echo $before . get_the_title() . $after; } elseif ( is_page() && $post->post_parent ) { $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = sprintf($link, get_permalink($page->ID), get_the_title($page->ID)); $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); for ($i = 0; $i < count($breadcrumbs); $i++) { echo $breadcrumbs[$i]; if ($i != count($breadcrumbs)-1) echo $delimiter; } if ($showCurrent == 1) echo $delimiter . $before . get_the_title() . $after; } elseif ( is_tag() ) { echo $before . sprintf($text['tag'], single_tag_title('', false)) . $after; } elseif ( is_author() ) { global $author; $userdata = get_userdata($author); echo $before . sprintf($text['author'], $userdata->display_name) . $after; } elseif ( is_404() ) { echo $before . $text['404'] . $after; } if ( get_query_var('paged') ) { if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' ('; echo __( 'Page', 'adsoft_language' ) . ' ' . get_query_var('paged'); if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')'; } echo '
'; } } // end adsoft_simplex_breadcrumbs() ?>