for posts and comments
//add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat', ) ); // post formats for future
register_nav_menu( 'primary-nav', __( 'Primary menu', 'activetab' ) ); // main nav menu in header
add_theme_support( 'custom-background' );
add_theme_support( 'post-thumbnails' ); // featured images
set_post_thumbnail_size( 800, 9999 ); // unlimited height, soft crop
$custom_header_args = array(
'default-image' => get_template_directory_uri() . '/img/headers/nature.jpg',
'random-default' => true, // random image rotation
'header-text' => false, // disable editing styles for text in header
// set height and width, with a maximum value for the width
'width' => 800,
'height' => 500,
'max-width' => 2000,
// support flexible height and width
'flex-height' => true,
'flex-width' => true
);
add_theme_support( 'custom-header', $custom_header_args ); // custom header See http://codex.wordpress.org/Custom_Headers
register_default_headers( array( // default custom headers packaged with the theme (%s is a placeholder for the theme template directory URI)
'nature' => array(
'url' => '%s/img/headers/nature.jpg',
'thumbnail_url' => '%s/img/headers/nature-thumbnail.jpg',
'description' => __( 'Nature', 'activetab' )
),
'relax' => array(
'url' => '%s/img/headers/relax.jpg',
'thumbnail_url' => '%s/img/headers/relax-thumbnail.jpg',
'description' => __( 'Relax', 'activetab' )
),
'space' => array(
'url' => '%s/img/headers/space.jpg',
'thumbnail_url' => '%s/img/headers/space-thumbnail.jpg',
'description' => __( 'Space', 'activetab' )
)
) );
/* ========== thumbnail size options ========== */
//add_image_size( 'thumb-400', 400, 999, false );
//add_image_size( 'thumb-200', 200, 999, false );
//add_image_size( 'thumb-100', 100, 999, false );
/*
to add more sizes, simply copy a line from above and change the dimensions & name.
As long as you upload a "featured image" as large as the biggest
set width or height, all the other sizes will be auto-cropped.
- shows the 200x200 sized image
*/
}
add_action( 'after_setup_theme', 'activetab_setup' );
endif; // activetab_setup()
// register sidebars & footer widgets
if ( ! function_exists( 'activetab_register_widgets' ) ) :
function activetab_register_widgets() {
register_sidebar( array(
'name' => __( 'Sidebar', 'activetab' ),
'id' => 'sidebar',
//'description' => 'Sidebar widgets description.',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer', 'activetab' ),
'id' => 'footer',
//'description' => 'description',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'activetab_register_widgets' );
endif; // activetab_register_widgets()
if ( ! function_exists( 'activetab_list_pages' ) ) :
function activetab_list_pages() {
?>
= 2 || $page >= 2 ) { // add a page number if necessary
$title .= ' ' . $sep . ' ' . sprintf( __( 'page %s', 'activetab' ), max( $paged, $page ) );
}
return $title;
}
add_filter( 'wp_title', 'activetab_title', 10, 2 );
endif; // activetab_title()
if ( ! function_exists( 'activetab_comments' ) ) :
function activetab_comments( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
'.__( 'edit', 'activetab' ), '' ); ?>
id="li-comment-">
'.''."\n";
return $post_date;
}
endif; // activetab_post_date()
if ( ! function_exists( 'activetab_post_author' ) ) :
function activetab_post_author() { // author
global $authordata;
if ( !is_object( $authordata ) )
return false;
$post_author = ' '.get_the_author().''."\n";
return $post_author;
}
endif; // activetab_post_author()
if ( ! function_exists( 'activetab_comments_count' ) ) :
function activetab_comments_count() {
$post_comments_count = '';
if( get_comments_number() != '0' ) {
$post_comments_count = ''."\n";
}
return $post_comments_count;
}
endif; // activetab_comments_count()
if ( ! function_exists( 'activetab_post_categories' ) ) :
function activetab_post_categories() { // list of categories
$post_categories = get_the_category_list( ', ' );
if( !empty( $post_categories ) ){
return ' '.$post_categories.''."\n";
}else{
return ''; // no categories
}
}
endif; // activetab_post_categories()
if ( ! function_exists( 'activetab_post_tags' ) ) :
function activetab_post_tags() { // list of tags
$post_tags = get_the_tag_list( '', ', ', '' );
if( !empty( $post_tags ) ){
return ' '.$post_tags.''."\n";
}else{
return ''; // no tags
}
}
endif; // activetab_post_tags()
if ( ! function_exists( 'activetab_post_meta' ) ) :
function activetab_post_meta() { // post meta
$post_meta = ''."\n" . activetab_post_date() . activetab_post_author() . activetab_comments_count() . activetab_post_categories() . '
'."\n";
$post_tags = activetab_post_tags();
if( !empty( $post_tags ) && is_single() ){
$post_meta .= ''."\n" . $post_tags . '
'."\n";
}
return "\n".''."\n".$post_meta.'
'."\n";
}
endif; // activetab_post_meta()
if ( ! function_exists( 'activetab_nav' ) ) :
function activetab_nav( $class='top' ) { // show next/prev navigation links when needed
global $wp_query;
$nav = '';
if ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages
if ( get_next_posts_link() ) :
$nav .= ''.get_next_posts_link( ' '.__( 'previous posts', 'activetab' ) ).'';
endif;
if ( get_previous_posts_link() ) :
$nav .= ''.get_previous_posts_link( __( 'next posts', 'activetab' ).' ' ).'';
endif;
endif;
if( !empty( $nav ) ) { // do not show empty markup
$nav = "\n".' '."\n";
}
return $nav;
}
endif; // activetab_nav()
if ( ! function_exists( 'activetab_excerpt_more' ) ) :
function activetab_excerpt_more( $more ) { // "more-link" is bad for seo and for usability - http://web-profile.com.ua/web/web-principles/more-link/
return '...';
}
add_filter('excerpt_more', 'activetab_excerpt_more');
endif; // activetab_excerpt_more()
if ( ! function_exists( 'activetab_is_homepage' ) ) :
function activetab_is_homepage(){ // does not used, simple way was chosen
// if( is_home() || is_front_page() ){} // simple way
$show_on_front = get_option('show_on_front'); // page or posts
$page_on_front = get_option('page_on_front'); // 0 or page_id
$page_for_posts = get_option('page_for_posts'); // 0 or page_id
if ( ($show_on_front == 'page') || ($page_on_front != 0) ){
if( is_front_page() ){
return true;
}
} elseif ( ( $show_on_front == 'posts' ) || ( $page_for_posts == 0 ) ) {
if( is_home() ){
return true;
}
} else {
return false;
}
}
endif; // activetab_is_homepage()