for posts and comments.
add_theme_support( 'automatic-feed-links' );
// Enable support for Post Thumbnails, and declare two sizes.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 798, 398, true );
add_image_size( 'avnii-full-width', 1038, 576, true );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'primary' => __( 'Main Menu', 'avnii' ),
'secondary' => __( 'Secondary menu for footer menu', 'avnii' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
/*
* Enable support for Post Formats.
*/
// This theme allows users to set a custom background.
add_theme_support( 'custom-background', apply_filters( 'avnii_custom_background_args', array(
'default-color' => 'f5f5f5',
) ) );
// Add support for featured content.
add_theme_support( 'featured-content', array(
'featured_content_filter' => 'avnii_get_featured_posts',
'max_posts' => 6,
) );
// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );
}
endif; // avnii_setup
add_action( 'after_setup_theme', 'avnii_setup' );
function avnii_of_head_css() {
$options = get_option( 'arinio_theme_options' );
$output = '';
$custom_css = esc_attr($options['customcss']);
if ($custom_css <> '') {
$output .= $custom_css . "\n";
}
// Output styles
if ($output <> '') {
$output = "\n\n";
echo $output;
}
}
add_action('wp_head', 'avnii_of_head_css');
// Adding breadcrumbs
function avnii_breadcrumbs() {
echo '
'. __('Home','avnii');
echo " ";
if (is_attachment()) {
echo "". __('attachment:','avnii');
echo " ";
}
if (is_category() || is_single()) {
if(is_category())
{
echo "". __('Category By:','avnii');
the_category(' • ');
echo " ";
}
if (is_single()) {
echo "";
$category = get_the_category();
echo ''.$category[0]->cat_name.' ';
echo " ";
echo "";
the_title();
echo " ";
}
} elseif (is_page()) {
echo "";
echo the_title();
echo " ";
} elseif (is_search()) {
echo "". __('Search Results for...','avnii');
echo '"';
echo the_search_query();
echo ' "';
echo " ";
} elseif (is_tag()) { echo ""; single_tag_title(); echo " ";}
elseif (is_day()) {echo"". __('Archive for ','avnii'); the_time('F jS, Y'); echo' ';}
elseif (is_month()) {echo"". __('Archive for ','avnii'); the_time('F, Y'); echo' ';}
elseif (is_year()) {echo"". __('Archive for ','avnii'); the_time('Y'); echo' ';}
elseif (is_author()) {echo"". __('Author Archive for ','avnii'); printf(__(' %s', 'avnii'), "" . get_the_author() . " "); echo' ';}
elseif (!is_single() && !is_page() && get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
//echo $before . $post_type->labels->singular_name . $after;
echo $before . ''. __('Search Results for "','avnii').'' . get_search_query() . '"' . $after; echo " ";
}
}
//fetch title
function avnii_title() {
if (is_category() || is_single())
{
if(is_category())
the_category();
if (is_single())
the_title();
}
elseif (is_page())
the_title();
elseif (is_search())
echo the_search_query();
}
/**
* Filter the page title.
**/
function avnii_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', 'avnii' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'avnii_wp_title', 10, 2 );
if ( ! function_exists( 'avnii_entry_meta' ) ) :
/**
* Set up post entry meta.
*
* Meta information for current post: categories, tags, permalink, author, and date.
**/
function avnii_entry_meta() {
$category_list = get_the_category_list( __( ', ', 'avnii' ) );
$tag_list = get_the_tag_list( '', __( ', ', 'avnii' ) );
$date = sprintf( '%4$s ',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() )
);
$author = sprintf( '%3$s ',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'avnii' ), get_the_author() ) ),
get_the_author()
);
if ( $tag_list ) {
$utility_text = __( ' Posted in : %1$s on %3$s
by : %4$s
', 'avnii' );
} elseif ( $category_list ) {
$utility_text = __( ' Posted in : %1$s on %3$s
by : %4$s
', 'avnii' );
} else {
$utility_text = __( ' Posted on : %3$s
by : %4$s
', 'avnii' );
}
printf(
$utility_text,
$category_list,
$tag_list,
$date,
$author
);
}
endif;
/**********************************/
function avnii_special_nav_class( $classes, $item )
{
$classes[] = 'special-class';
return $classes;
}
add_filter( 'nav_menu_css_class', 'avnii_special_nav_class', 10, 2 );
/**
* Register avnii widget areas.
*
*/
function avnii_widgets_init() {
register_sidebar( array(
'name' => __( 'Content Sidebar', 'avnii' ),
'id' => 'content-sidebar',
'description' => __( 'Additional sidebar that appears on the right.', 'avnii' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar', 'avnii' ),
'id' => 'footer-sidebar',
'description' => __( 'Appears on footer side', 'avnii' ),
'before_widget' => '',
'before_title' => '',
'after_title' => ' ',
) );
}
add_action( 'widgets_init', 'avnii_widgets_init' );
/* avnii Theme End */
/*
* Add Active class to Wp-Nav-Menu
*/
function avnii_active_nav_class($classes, $item){
if( in_array('page_item', $classes) ){
$classes[] = 'active ';
}
return $classes;
}
add_filter('nav_menu_css_class' , 'avnii_active_nav_class' , 10 , 2);
function avnii_add_nav_class($output) {
$output= preg_replace('/