for posts and comments.
add_theme_support( 'automatic-feed-links' );
// This theme supports a variety of post formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'primary', __( 'Primary Menu', 'jatheme' ) );
//This theme supports custom background color and image,
add_theme_support( 'custom-background', array(
'default-color' => 'eaeaea',
) );
// This theme uses a custom image size for featured images, displayed on "standard" posts.
add_theme_support( 'post-thumbnails' );
// Unlimited height, soft crop
set_post_thumbnail_size( 624, 9999 );
// This theme supports custom header image.
$custom_header = array(
'default-image' => '',
'random-default' => false,
'width' => 0,
'height' => 0,
'flex-height' => false,
'flex-width' => false,
'default-text-color' => '',
'header-text' => true,
'uploads' => true,
'wp-head-callback' => '',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $custom_header );
// This theme supports html5.
add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
}
add_action( 'after_setup_theme', 'artikler_theme_setup' );
//Register sidebars(Main Sidebar).
function artikler_theme_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'jatheme' ),
'id' => 'sidebar-1',
'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'jatheme' ),
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'artikler_theme_widgets_init' );
//Displays navigation.
function artikler_theme_content_nav( $html_id ) {
global $wp_query;
$html_id = esc_attr( $html_id ); ?>
',
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', 'jatheme' ), get_the_author() ) ),
get_the_author()
);
//1 = category, 2 = tag, 3 = the date and 4 = author's name.
if ( $tag_list ) {
$full_text = __( 'Category: %1$s | Tag: %2$s | Date: %3$s | Author: %4$s.', 'jatheme' );
} elseif ( $categories_list ) {
$full_text = __( 'Category: %1$s | Date: %3$s | Author: %4$s.', 'jatheme' );
} else {
$full_text = __( 'Date: %3$s | Author: %4$s.', 'jatheme' );
}
printf(
$full_text,
$categories_list,
$tag_list,
$date,
$author
);
}
endif;
//Excerpt Length.
function custom_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
//Excerpt More.
function new_excerpt_more( $more ) {
return ' ' . __('Read More', 'artikler') . '';
}
add_filter( 'excerpt_more', 'new_excerpt_more' );
//Support Google font stylesheet URL
function artikler_theme_get_font_url() {
$font_url = '';
if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'jatheme' ) ) {
$subsets = 'latin,latin-ext';
$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)', 'jatheme' );
if ( 'cyrillic' == $subset )
$subsets .= ',cyrillic,cyrillic-ext';
elseif ( 'greek' == $subset )
$subsets .= ',greek,greek-ext';
elseif ( 'vietnamese' == $subset )
$subsets .= ',vietnamese';
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array(
'family' => 'Open+Sans:400italic,700italic,400,700',
'subset' => $subsets,
);
$font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
}
return $font_url;
}
//Style and Scriprt.
function artikler_scripts() {
global $wp_styles;
wp_enqueue_style( 'style-sheet', get_stylesheet_uri() );
wp_enqueue_script( 'script-html5', get_template_directory_uri() . '/js/html5.js', array(), '1.0.0', true );
wp_enqueue_style('googleFontsOpen+Sans', 'http://fonts.googleapis.com/css?family=Open+Sans:400,700');
wp_register_style('googleFontsTangerine', 'http://fonts.googleapis.com/css?family=Tangerine');
wp_enqueue_style( 'googleFontsTangerine');
$font_url = artikler_theme_get_font_url();
if ( ! empty( $font_url ) )
wp_enqueue_style( 'jatheme-fonts', esc_url_raw( $font_url ), array(), null );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'artikler_scripts' );
function artikler_theme_mce_css( $mce_css ) {
$font_url = artikler_theme_get_font_url();
if ( empty( $font_url ) )
return $mce_css;
if ( ! empty( $mce_css ) )
$mce_css .= ',';
$mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) );
return $mce_css;
}
add_filter( 'mce_css', 'artikler_theme_mce_css' );
/**
* Filters the page title appropriately depending on the current page
*
* This function is attached to the 'wp_title' fiilter hook.
*
* @uses get_bloginfo()
* @uses is_home()
* @uses is_front_page()
*/
function filter_wp_title( $title ) {
global $page, $paged;
if ( is_feed() )
return $title;
$site_description = get_bloginfo( 'description' );
$filtered_title = $title . get_bloginfo( 'name' );
$filtered_title .= ( ! empty( $site_description ) && ( is_home() || is_front_page() ) ) ? ' | ' . $site_description: '';
$filtered_title .= ( 2 <= $paged || 2 <= $page ) ? ' | ' . sprintf( max( $paged, $page ) ) : '';
return $filtered_title;
}
add_filter( 'wp_title', 'filter_wp_title' );
/**
* Filter the page menu arguments.
*/
function artikler_theme_page_menu_args( $args ) {
if ( ! isset( $args['show_home'] ) )
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'artikler_theme_page_menu_args' );
/**
* Register postMessage support.
* WP_Customize_Manager $wp_customize Customizer object.
*/
function artikler_theme_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
}
add_action( 'customize_register', 'artikler_theme_customize_register' );
function artikler_theme_add_editor_styles() {
add_editor_style( get_stylesheet_uri() );
}
add_action( 'after_setup_theme', 'artikler_theme_add_editor_styles' );
function get_all_posts(){
/* Start the Loop */
while ( have_posts() ) : the_post(); ?>