tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function dk_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', 'dk-responsive' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'dk_wp_title', 10, 2 ); /** * Sets the authordata global when viewing an author archive. * * This provides backwards compatibility with * http://core.trac.wordpress.org/changeset/25574 * * It removes the need to call the_post() and rewind_posts() in an author * template to print information about the author. * * @global WP_Query $wp_query WordPress Query object. * @return void */ function dk_setup_author() { global $wp_query; if ( $wp_query->is_author() && isset( $wp_query->post ) ) { $GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author ); } } add_action( 'wp', 'dk_setup_author' ); //set page templates function dk_get_current_layout() { global $post; /* 404 pages */ if( is_404() ) { return 'default'; } $layout = ''; $layout= esc_attr(dk_get_option('layout')); if(empty($layout)){ $layout="content-sidebar"; } /* if(is_front_page() || is_archive() || is_single() || is_home() ){ $page_template='default'; } else { $page_template = get_post_meta( $post->ID, '_wp_page_template', true ); } */ if(is_page()) { $page_template = get_post_meta( $post->ID, '_wp_page_template', true ); } else { $page_template='default'; } if( 'default' != $page_template ) { $layout= $page_template; } else { $layout=$layout; } return apply_filters( 'dk_get_layout', $layout ); } function dk_content_classes() { $layout= dk_get_current_layout(); if( $layout == 'content-sidebar' ) { $primary_content_classes[] = 'pull-left'; $primary_content_classes[] = 'col-md-8'; } elseif( 'sidebar-content' == $layout ) { $primary_content_classes[] = 'pull-right'; $primary_content_classes[] = 'col-md-8'; } elseif( 'full-width' == $layout ) { $primary_content_classes[] = 'col-md-12'; } return apply_filters( 'dk_content_classes', $primary_content_classes ); } function dk_sidebar_classes() { $sidebar_classes = array(); $layout= dk_get_current_layout(); if( in_array( $layout, array( 'content-sidebar' ) ) ) { /* $sidebar_classes[] = 'pull-right'; */ $sidebar_classes[] = 'col-md-4'; } elseif( 'sidebar-content' == $layout ) { /* $sidebar_classes[] = 'pull-left'; */ $sidebar_classes[] = 'col-md-4'; } return apply_filters( 'dk_sidebar_classes', $sidebar_classes ); } //Sets the post excerpt length to 40 words. function dk_excerpt_length( $length ) { return 40; } add_filter( 'excerpt_length', 'dk_excerpt_length' ); function dk_read_more() { return '
'; } function dk_excerpt_more( $more ) { return '…' ; } add_filter( 'excerpt_more', 'dk_excerpt_more' ); // add a favicon function dk_site_favicon() { $web_favicon= dk_get_option('web_favicon'); if(isset($web_favicon)) { echo ''; } } add_action('wp_head', 'dk_site_favicon'); // add a favicon to admin function dk_admin_favicon() { $admin_favicon= dk_get_option('admin_favicon'); if(isset($admin_favicon)) { echo ''; } } add_action('admin_head', 'dk_admin_favicon'); // retrive theme options function dk_get_options() { global $dk_options; // Global Variable $themename = get_option( 'stylesheet' ); $themename = preg_replace("/\W/", "_", strtolower($themename) ); $dk_framework_settings['id']= $themename; $dk_options = wp_parse_args( get_option( $dk_framework_settings['id'], array() )); return $dk_options; } // bootstrap css function dk_add_scripts() { wp_enqueue_script( 'bootstrap-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js',array( 'jquery' ), false, false ); if ( is_rtl() ) { wp_enqueue_style( 'dk-rtl-style', get_template_directory_uri() . '/rtl.css', false ); } } add_action( 'wp_enqueue_scripts', 'dk_add_scripts' ); function dk_remove_footer_admin () { echo __( 'Fueled by WordPress | Designed by Zenant', 'dk-responsive' ); } add_filter('admin_footer_text', 'dk_remove_footer_admin'); add_action('wp_dashboard_setup', 'dk_custom_dashboard_widgets'); function dk_custom_dashboard_widgets() { global $wp_meta_boxes; wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'dk_dashboard_help'); } function dk_dashboard_help() { echo __( 'Welcome to DK Responsive Theme! Need help? Contact the developer here.visit: Zenant', 'dk-responsive' ); } function dk_custom_breadcrumbs() { $showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $delimiter = '»'; // delimiter between crumbs $home = 'Home'; // text for the 'Home' link $showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb global $post; $homeLink = esc_url(home_url()); if (is_home() || is_front_page()) { if ($showOnHome == 1) echo ''; } else { echo '