for posts and comments
add_theme_support( 'title-tag' ); // let WordPress manage the document title
//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
add_theme_support( 'woocommerce' );
$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;
// register sidebars & footer widgets
if ( ! function_exists( 'activetab_register_widgets' ) ) :
function activetab_register_widgets() {
register_sidebar( array(
'name' => __( 'Sidebar Left', 'activetab' ),
'id' => 'sidebar_left',
//'description' => 'Sidebar Left.',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Sidebar Right', 'activetab' ),
'id' => 'sidebar_right',
//'description' => 'Sidebar Right.',
'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;
if ( ! function_exists( 'activetab_list_pages' ) ) :
function activetab_list_pages() {
?>
comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="comment-">
comment_type == 'pingback' ) {
_e( 'Pingback:', 'activetab' );
} else {
_e( 'Trackback:', 'activetab' );
}
?>
'.__( 'Edit', 'activetab' ).'', '' ); ?>
id="li-comment-">
'.''."\n";
return $post_date;
}
endif;
if ( ! function_exists( 'activetab_post_sticky' ) ) :
function activetab_post_sticky() {
$post_sticky = '';
if( is_sticky() ) { // add 'sticky' label to sticky post
$sticky = ' '.__( 'Sticky', 'activetab' ).'';
$post_sticky = ''.$sticky.''."\n";
}
return $post_sticky;
}
endif;
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;
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;
if ( ! function_exists( 'activetab_post_categories' ) ) :
function activetab_post_categories() { // list of categories
$post_categories = get_the_category_list( __( ', ', 'activetab' ) );
if ( !empty( $post_categories ) ) {
return ' '.$post_categories.''."\n";
} else {
return ''; // no categories
}
}
endif;
if ( ! function_exists( 'activetab_post_tags' ) ) :
function activetab_post_tags() { // list of tags
$post_tags = get_the_tag_list( '', __( ', ', 'activetab' ), '' );
if( !empty( $post_tags ) ){
return ' '.$post_tags.''."\n";
}else{
return ''; // no tags
}
}
endif;
if ( ! function_exists( 'activetab_post_meta' ) ) :
function activetab_post_meta() { // post meta
$post_meta = ''."\n" . activetab_post_sticky() . 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;
if ( ! function_exists( 'activetab_nav' ) ) :
function activetab_nav( $class='top' ) { // show next/prev navigation links when needed
// todo: replace with get_the_posts_navigation();
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;
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;
if ( ! function_exists( 'activetab_is_homepage' ) ) :
function activetab_is_homepage() {
global $paged;
// 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() && $paged < 2 ) { // show link to homepage from paged pages
return true;
}
} else {
return false;
}
}
endif;
if ( ! function_exists( 'activetab_rss_button' ) ) :
function activetab_rss_button() { // output content to the footer section
$output = '';
if ( is_category() ) {
$output = '';
} elseif ( is_tag() ) {
$output = '';
} elseif ( is_author() ) {
$output = '';
}
return $output;
}
endif;
if ( ! function_exists( 'activetab_wp_head' ) ) :
function activetab_wp_head() { // output content to the head section
$settings = activetab_get_settings();
$code_head = $settings['code_head'];
$max_width = $settings['max_width'];
if ( ! empty( $max_width ) ) {
echo "\n".''."\n";
echo ''."\n";
echo "\n".''."\n";
}
if ( ! empty( $code_head ) ) {
echo "\n".''."\n";
echo $code_head;
echo "\n".''."\n";
}
}
add_action( 'wp_head', 'activetab_wp_head' );
endif;
if ( ! function_exists( 'activetab_wp_footer' ) ) :
function activetab_wp_footer() { // output content to the footer section
$settings = activetab_get_settings();
$code_footer = $settings['code_footer'];
if ( ! empty( $code_footer ) ) {
echo "\n".''."\n";
echo $code_footer;
echo "\n".''."\n";
}
}
add_action( 'wp_footer', 'activetab_wp_footer' );
endif;