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/borabora.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
// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
register_default_headers( array(
'borabora' => array(
'url' => '%s/img/headers/borabora.jpg',
'thumbnail_url' => '%s/img/headers/borabora-thumbnail.jpg',
'description' => __( 'Bora Bora', 'activetab' )
),
'coloredfeathers' => array(
'url' => '%s/img/headers/coloredfeathers.jpg',
'thumbnail_url' => '%s/img/headers/coloredfeathers-thumbnail.jpg',
'description' => __( 'Colored feathers', 'activetab' )
),
'starrynight' => array(
'url' => '%s/img/headers/starrynight.jpg',
'thumbnail_url' => '%s/img/headers/starrynight-thumbnail.jpg',
'description' => __( 'Starry Night', '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( 'admin_menu', 'cozy_add_customize_to_admin_menu' );
function cozy_add_customize_to_admin_menu() { // add the 'Customize' link to the admin menu
add_theme_page( 'Customize', 'Customize', 'edit_theme_options', 'customize.php' );
}
}
endif;
// register sidebars & footer widgets
if ( ! function_exists( 'activetab_register_widgets' ) ) :
add_action( 'widgets_init', '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' => 'You can use shortcodes: [c] [year] [homelink]',
'before_widget' => '',
'before_title' => '',
) );
}
endif;
if ( ! function_exists( 'activetab_favicon' ) ) :
add_action( 'wp_head', 'activetab_favicon' ); // add favicon to frontend
add_action( 'admin_head', 'activetab_favicon' ); // add favicon to backend
function activetab_favicon() {
echo "\n".''."\n";
}
endif;
if ( ! function_exists( 'activetab_list_pages' ) ) :
function activetab_list_pages() {
?>
= 2 || $page >= 2 )
$title .= ' ' . $sep . ' ' . sprintf( __( 'page %s', 'activetab' ), max( $paged, $page ) );
$title = wptexturize( $title );
return $title;
}
endif;
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-">
'.'';
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().'';
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 = '';
}
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.'';
}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.'';
}else{
return ''; // no tags
}
}
endif; // activetab_post_tags
if ( ! function_exists( 'activetab_post_meta' ) ) :
function activetab_post_meta() { // post meta
$post_meta = '' . activetab_post_date() . activetab_post_author() . activetab_comments_count() . activetab_post_categories() . '
';
$post_tags = activetab_post_tags();
if( !empty( $post_tags ) && is_single() ){
$post_meta .= '' . $post_tags . '
';
}
return "\n".''."\n".$post_meta."\n".'
'."\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) { // do not use "more-link" 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
// enable shortcodes in widgets
add_filter('widget_text', 'do_shortcode');
// ===== filtered code up here ============================================================
/****************** password protected post form *****/
if ( ! function_exists( 'activetab_custom_password_form' ) ):
add_filter( 'the_password_form', 'activetab_custom_password_form' );
function activetab_custom_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$o = '
';
return $o;
}
endif; // activetab_custom_password_form
if ( ! function_exists( 'activetab_remove_more_jump_link' ) ):
add_filter('the_content_more_link', 'activetab_remove_more_jump_link');
function activetab_remove_more_jump_link($link) { // disable jump in 'read more' link
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
}
return $link;
}
endif; // activetab_remove_more_jump_link
if ( ! function_exists( 'activetab_remove_thumbnail_dimensions' ) ):
add_filter( 'post_thumbnail_html', 'activetab_remove_thumbnail_dimensions', 10 );
add_filter( 'image_send_to_editor', 'activetab_remove_thumbnail_dimensions', 10 );
function activetab_remove_thumbnail_dimensions( $html ) { // Remove height/width attributes on images so they can be responsive
$html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
return $html;
}
endif; // activetab_remove_thumbnail_dimensions
if ( ! function_exists( 'is_activetab_homepage' ) ):
function is_activetab_homepage() { // check for real homepage
$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; // is_activetab_homepage