for posts and comments.
add_theme_support( 'automatic-feed-links' );
global $content_width;
if ( ! isset( $content_width ) )
$content_width = 900; /* pixels */
add_theme_support( "title-tag" );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 798, 398, true );
add_image_size( 'alum-full-width', 1038, 576, true );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'primary' => __( 'Main Menu', 'alum' ),
'secondary' => __( 'Secondary menu for footer menu', 'alum' ),
) );
/*
* 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( 'alum_custom_background_args', array(
'default-color' => 'f5f5f5',
) ) );
// Add support for featured content.
add_theme_support( 'featured-content', array(
'featured_content_filter' => 'alum_get_featured_posts',
'max_posts' => 6,
) );
// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );
}
endif; // alum_setup
add_action( 'after_setup_theme', 'alum_setup' );
function alum_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', 'alum_of_head_css');
function alum_header_add_favicon() {
$options = get_option( 'arinio_theme_options' );
$outputfevicon = '';
$custom_fevicon = esc_attr($options['fevicon']);
if ($custom_fevicon <> '') {
$outputfevicon .= $custom_fevicon . "\n";
}
// Output styles
if ($outputfevicon <> '') {
$outputfevicon = '';
echo $outputfevicon;
}
}
add_action('wp_head', 'alum_header_add_favicon');
// Adding breadcrumbs
function alum_breadcrumbs() {
echo '
'. __('Home','alum');
echo "";
if (is_attachment()) {
echo "". __('attachment:','alum');
echo "";
}
if (is_category() || is_single()) {
if(is_category())
{
echo "". __('Category By:','alum');
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...','alum');
echo '"';
echo the_search_query();
echo '"';
echo "";
} elseif (is_tag()) { echo ""; single_tag_title(); echo "";}
elseif (is_day()) {echo"". __('Archive for ','alum'); the_time('F jS, Y'); echo'';}
elseif (is_month()) {echo"". __('Archive for ','alum'); the_time('F, Y'); echo'';}
elseif (is_year()) {echo"". __('Archive for ','alum'); the_time('Y'); echo'';}
elseif (is_author()) {echo"". __('Author Archive for ','alum'); printf(__(' %s', 'alum'), "" . 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 "','alum').'' . get_search_query() . '"' . $after; echo "";
}
}
//fetch title
function alum_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 alum_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', 'alum' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'alum_wp_title', 10, 2 );
if ( ! function_exists( 'alum_entry_meta' ) ) :
/**
* Set up post entry meta.
*
* Meta information for current post: categories, tags, permalink, author, and date.
**/
function alum_entry_meta() {
$category_list = get_the_category_list( __( ', ', 'alum' ) );
$tag_list = get_the_tag_list( '', __( ', ', 'alum' ) );
$date = sprintf( '',
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', 'alum' ), get_the_author() ) ),
get_the_author()
);
if ( $tag_list ) {
$utility_text = __( ' Posted in : %1$s on %3$s
by : %4$s
', 'alum' );
} elseif ( $category_list ) {
$utility_text = __( ' Posted in : %1$s on %3$s
by : %4$s
', 'alum' );
} else {
$utility_text = __( ' Posted on : %3$s
by : %4$s
', 'alum' );
}
printf(
$utility_text,
$category_list,
$tag_list,
$date,
$author
);
}
endif;
/**********************************/
function alum_special_nav_class( $classes, $item )
{
$classes[] = 'special-class';
return $classes;
}
add_filter( 'nav_menu_css_class', 'alum_special_nav_class', 10, 2 );
/**
* Register alum widget areas.
*
*/
function alum_widgets_init() {
register_sidebar( array(
'name' => __( 'Content Sidebar', 'alum' ),
'id' => 'content-sidebar',
'description' => __( 'Additional sidebar that appears on the right.', 'alum' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar', 'alum' ),
'id' => 'footer-sidebar',
'description' => __( 'Appears on footer side', 'alum' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
'items_wrap' => ''
) );
}
add_action( 'widgets_init', 'alum_widgets_init' );
/* alum Theme End */
/*
* Add Active class to Wp-Nav-Menu
*/
function alum_active_nav_class($classes, $item){
if( in_array('page_item', $classes) ){
$classes[] = 'active ';
}
return $classes;
}
add_filter('nav_menu_css_class' , 'alum_active_nav_class' , 10 , 2);
function alum_add_nav_class($output) {
$output= preg_replace('/