'505050',
'default-image' => get_template_directory_uri() . '/images/honeycomb.png',
) );
add_theme_support( 'custom-header', array(
'default-image' => '',
'random-default' => false,
'width' => $asr_container,
'height' => $asr_header,
'flex-height' => true,
'flex-width' => true,
'header-text' => false,
'uploads' => true,
) );
add_theme_support( 'post-thumbnails' );
add_image_size( 'thumb-200x120', 200, 120, true );
add_theme_support( 'html5', array( 'search-form', 'comment-form' ) );
add_filter( 'widget_text', 'do_shortcode' );
add_action( 'wp_head', 'asr_meta_charset', 0 );
add_action( 'wp_head', 'asr_meta_viewport', 0 );
add_action( 'wp_head', 'asr_link_profile', 1 );
add_action( 'wp_head', 'asr_link_pingback', 1 );
// Print CSS for layout
add_action( 'wp_head', 'asr_print_layout' );
add_action( 'wp_head', 'asr_print_layout_page' );
// Print CSS for header image
if ( !( get_header_image() == '' ) ) add_action( 'wp_head', 'asr_header_image' );
// Print CSS for colors
if ( asr_option('colors_enable') == 1 ) add_action( 'wp_head', 'asr_custom_colors' );
// Print Custom CSS if available
if ( asr_option('custom_css') ) add_action( 'wp_head', 'asr_print_custom_css', 990 );
if ( asr_option('favicon') ) add_action( 'wp_head', 'asr_favicon', 8 );
if ( asr_option('head_codes') ) add_action( 'wp_head', 'asr_head_codes' );
if ( asr_option('editor_style_disable') != 1 ) asr_editor_style();
if ( asr_option('responsive_disable', 0) != 1 ) add_action( 'wp_footer', 'asr_menu_style_script', 18 );
if ( asr_option('slider_enable') == 1 ) {
asr_show_slider();
add_action( 'wp_footer', 'asr_slider_script', 20 );
if ( asr_option('slider_stretch') == 'stretch' ) add_action( 'wp_head', 'asr_slider_stretch' );
}
}
add_action( 'after_setup_theme', 'asr_theme_setup' );
/*-------------------------------------
ASR WP Title
--------------------------------------*/
if ( ! function_exists( '_wp_render_title_tag' ) ) {
add_action( 'wp_head', 'asr_wp_title_render', 1 );
}
function asr_wp_title_render() {
?>
add_menu( array(
'parent' => false,
'id' => 'asr_admin_bar',
'title' => __('ASR Options', 'asr'),
'href' => admin_url('themes.php?page=asr-options') ) );
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'theme_editor_admin_bar',
'title' => __('Editor', 'asr'),
'href' => admin_url('theme-editor.php') ) );
$wp_admin_bar->add_menu( array(
'parent' => 'appearance',
'id' => 'plugins_admin_bar',
'title' => __('Plugins', 'asr'),
'href' => admin_url('plugins.php') ) );
}
}
add_action( 'admin_bar_menu', 'asr_admin_bar_menu', 88 );
/*----------------------------------------
Register Sidebars
-----------------------------------------*/
function asr_register_sidebars() {
register_sidebar( array(
'name' => __('Sidebar – Left', 'asr'),
'id' => 'widgets_sidebar_left',
'description' => __('For layouts and templates with a left sidebar.', 'asr'),
'before_widget' => '',
'before_title' => '') );
register_sidebar( array(
'name' => __('Sidebar – Right', 'asr'),
'id' => 'widgets_sidebar_right',
'description' => __('For layouts and templates with a right sidebar.', 'asr'),
'before_widget' => '',
'before_title' => '') );
asr_register_sidebars_extra();
}
add_action( 'widgets_init', 'asr_register_sidebars' );
function asr_register_sidebars_extra() {
$widget_areas = asr_option('widget_areas');
if ( $widget_areas['body'] == 1 ) {
register_sidebar( array(
'name' => __('Body', 'asr'),
'id' => 'widgets_body',
'description' => __('Widgets outside of the container. If used, you\'ll have to position the widgets with css.', 'asr'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
if ( !isset($widget_areas['header']) || $widget_areas['header'] == 1 ) {
register_sidebar( array(
'name' => __('Header', 'asr'),
'id' => 'widgets_header',
'description' => __('Widgets to appear on the header. Ideal for horizontal ads or banners.', 'asr'),
'before_widget' => '',
'before_title' => '') );
}
if ( $widget_areas['below_menu'] == 1 ) {
register_sidebar( array(
'name' => __('Below Menu', 'sr'),
'id' => 'widgets_below_menu',
'description' => __('Full-width widgets that appear under the main menu. Ideal for horizontal ads or banners.', 'asr'),
'before_widget' => '',
'before_title' => '') );
}
if ( $widget_areas['before_content'] == 1 ) {
register_sidebar(array(
'name' => __('Before Content', 'asr'),
'id' => 'widgets_before_content',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
if ( $widget_areas['after_content'] == 1 ) {
register_sidebar( array(
'name' => __('After Content', 'asr'),
'id' => 'widgets_after_content',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
if ( !isset($widget_areas['footer']) || $widget_areas['footer'] == 1 ) {
register_sidebar( array(
'name' => __('Footer', 'asr'),
'id' => 'widgets_footer',
'description' => __('You can set the number of widgets per row on the options page. 1, 2, 3, 4, 5 or 6 columns.', 'asr'),
'before_widget' => '',
'before_title' => '') );
}
if ( !isset($widget_areas['post_header']) || $widget_areas['post_header'] == 1 ) {
register_sidebar( array(
'name' => __('Post – Header', 'asr'),
'id' => 'widgets_before_post',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
if ( !isset($widget_areas['post_before_content']) || $widget_areas['post_before_content'] == 1 ) {
register_sidebar( array(
'name' => __('Post – Before Content', 'asr'),
'id' => 'widgets_before_post_content',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
if ( !isset($widget_areas['post_after_content']) || $widget_areas['post_after_content'] == 1 ) {
register_sidebar( array(
'name' => __('Post – After Content', 'asr'),
'id' => 'widgets_after_post_content',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
if ( !isset($widget_areas['post_footer']) || $widget_areas['post_footer'] == 1 ) {
register_sidebar( array(
'name' => __('Post – Footer', 'asr'),
'id' => 'widgets_after_post',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '') );
}
}
/*-------------------------------------
Add Common Items
--------------------------------------*/
function asr_meta_charset() {
echo ' ' . "\n";
}
function asr_meta_viewport() {
echo ' ' . "\n";
}
function asr_link_profile() {
echo ' ' . "\n";
}
function asr_link_pingback() {
echo ' ' . "\n";
}
/*-------------------------------------
Get Layout Values - Theme Setup
--------------------------------------*/
function asr_get_layout_values() {
global $content_width, $asr_container, $asr_header, $asr_content, $asr_side_left, $asr_side_right, $footer_widget_css,
$asr_2col_content, $asr_2col_sidebar, $asr_3col_content, $asr_3col_sidebar1, $asr_3col_sidebar2;
$asr_container = asr_option('width_container', 960);
$asr_header = asr_option('header_height', 140);
$asr_2col_content = asr_option('width_two_column', 65);
$asr_2col_sidebar = 100 - asr_option('width_two_column', 65);
$asr_3col_value = explode( '-', asr_option('width_three_column', '25-75') );
$asr_3col_content = $asr_3col_value[1] - $asr_3col_value[0];
$asr_3col_sidebar1 = $asr_3col_value[0];
$asr_3col_sidebar2 = 100 - $asr_3col_value[1];
switch ( asr_option('column_layout', 'col-cs') ) {
case 'col-c' :
$asr_content = 100;
$content_width = $asr_container - 42;
break;
case 'col-sc' :
case 'col-cs' :
$asr_content = $asr_2col_content;
$asr_side_left = $asr_2col_sidebar;
$asr_side_right = $asr_2col_sidebar;
$content_width = intval( $asr_container * ( $asr_content / 100 ) ) - 38;
break;
case 'col-ssc' :
case 'col-css' :
case 'col-scs' :
$asr_content = $asr_3col_content;
$asr_side_left = $asr_3col_sidebar1;
$asr_side_right = $asr_3col_sidebar2;
$content_width = intval( $asr_container * ( $asr_content / 100 ) ) - 38;
break;
}
}
/*-------------------------------------
Layout CSS - Theme Setup
--------------------------------------*/
function asr_print_layout() {
global $asr_version, $asr_container,
$asr_content, $asr_side_left, $asr_side_right;
$header_min = ( asr_option('header_logo') ) ? 0 : asr_option('header_height', 140);
echo '
' . "\n";
}
/*-------------------------------------
Layout CSS for Pages - Theme Setup
--------------------------------------*/
function asr_print_layout_page() {
global $asr_2col_content, $asr_2col_sidebar,
$asr_3col_content, $asr_3col_sidebar1, $asr_3col_sidebar2;
echo '
' . "\n\n";
}
/*-------------------------------------
Header BG CSS - Theme Setup
--------------------------------------*/
function asr_header_image() {
global $asr_container, $asr_header;
echo
'' . "\n\n";
}
/*-------------------------------------
Custom Colors CSS - Theme Setup
--------------------------------------*/
function asr_custom_colors() {
$colormotif = asr_option('color_motif');
$colortopbar = asr_option('color_top_bar');
$colorheader = asr_option('color_header');
$colormenu = asr_option('color_menu_main');
$colorbottombar = asr_option('color_bottom_bar');
$colorlinks = asr_option('color_links');
$colorlinkshover = asr_option('color_links_hover');
echo
'' . "\n\n";
}
function asr_alter_color( $hex, $steps ) {
$steps = max(-255, min(255, $steps));
$hex = str_replace('#', '', $hex);
if (strlen($hex) == 3) {
$hex = str_repeat(substr($hex,0,1), 2).str_repeat(substr($hex,1,1), 2).str_repeat(substr($hex,2,1), 2);
}
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
$r = max(0,min(255,$r + $steps));
$g = max(0,min(255,$g + $steps));
$b = max(0,min(255,$b + $steps));
$r_hex = str_pad(dechex($r), 2, '0', STR_PAD_LEFT);
$g_hex = str_pad(dechex($g), 2, '0', STR_PAD_LEFT);
$b_hex = str_pad(dechex($b), 2, '0', STR_PAD_LEFT);
return '#'.$r_hex.$g_hex.$b_hex;
}
/*-------------------------------------
Custom CSS - Theme Setup
--------------------------------------*/
function asr_print_custom_css() {
echo "\n" . '' . "\n" . '' . "\n" . '' . "\n\n";
}
/*-------------------------------------
Favicon - Theme Setup
--------------------------------------*/
function asr_favicon() {
echo ' ' . "\n";
}
/*-------------------------------------
Custom Codes - Theme Setup
--------------------------------------*/
function asr_head_codes() {
echo '' . "\n";
echo asr_option('head_codes');
echo "\n" . '' . "\n\n";
}
/*----------------------------------------
Post Editor Style - Theme Setup
-----------------------------------------*/
function asr_editor_style() {
add_editor_style();
add_action( 'before_wp_tiny_mce', 'asr_tinymce_width' );
}
function asr_tinymce_width() {
global $content_width, $asr_container, $asr_2col_content, $asr_3col_content;
$tinymce_width = $content_width;
switch ( get_page_template_slug() ) {
case 'page-c.php' :
case 'page-blank.php' :
$tinymce_width = $asr_container - 42;
break;
case 'page-sc.php' :
case 'page-cs.php' :
$tinymce_width = intval( $asr_container * ( $asr_2col_content / 100 ) ) - 38;
break;
case 'page-scs.php' :
$tinymce_width = intval( $asr_container * ( $asr_3col_content / 100 ) ) - 38;
break;
}
?>
';
get_template_part('slider');
echo '';
}
}
function asr_slider_on_content() {
if ( is_home() || is_front_page() ) {
echo '';
get_template_part('slider');
echo '
';
}
}
/*-------------------------------------
Slider Script - Theme Setup
--------------------------------------*/
function asr_slider_script() {
global $asr_container, $asr_content;
$slider_width = asr_option('slider_position') == 'before_main' ? $asr_container : $asr_container * ( $asr_content / 100 );
?>
.bjqs-slide a, .bjqs-slide img {height: 100%; width: 100%;}' . "\n\n";
}
/*-------------------------------------
Attachment Page Image
--------------------------------------*/
function asr_prepend_attachment( $content ) {
$attachment_image = '';
$attachment_image .= wp_get_attachment_link( 0, apply_filters( 'asr_attachment_image_size', 'full' ), false );
$attachment_image .= '
' . get_post()->post_excerpt . '
';
$attachment_image .= '
';
if ( wp_attachment_is_image() )
return $attachment_image;
else
return $content;
}
add_filter( 'prepend_attachment', 'asr_prepend_attachment' );
/*-------------------------------------
Callback: Comment Markup
--------------------------------------*/
function asr_comments( $comment, $args, $depth ) {
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
?>
< id="comment-" >