'',
'default-repeat' => 'no-repeat',
'default-text-color' => '00BAE1',
'url' => '',
'width' => 1920,
'height' => 89,
'flex-height' => true
);
$background_args = array(
'default-color' => 'f7f8f8',
);
add_theme_support( 'custom-background', $background_args );
add_theme_support( 'custom-header', $header_args );
add_theme_support( 'automatic-feed-links' );//
add_theme_support( 'custom-logo', array(
'height' => 50,
'width' => 50,
'flex-width' => true,
) );
//register menus
register_nav_menus(
array(
'header-menu' => __( 'Header Menu', 'ascreen' ) ,
'footer-menu' => __( 'Footer Menu', 'ascreen' )
)
);
add_theme_support( "title-tag" );//
add_editor_style("editor-style.css");
if ( !isset( $content_width ) ) $content_width = 1170;
}
add_action( 'after_setup_theme', 'ascreen_setup' );
function ascreen_custom_scripts()
{
global $is_IE;
$theme_info = wp_get_theme();
wp_enqueue_style('ascreen-base', get_template_directory_uri() .'/css/base.css', false, $theme_info->get( 'Version' ), false);
wp_enqueue_style('ascreen-main', get_stylesheet_uri(), false, $theme_info->get( 'Version' ) );
wp_enqueue_script('ascreen-main', get_template_directory_uri().'/js/main.js', array( 'jquery' ),$theme_info->get( 'Version' ), false );
//video
wp_enqueue_script('jquery.mb.YTPlayer.js', get_template_directory_uri().'/js/jquery.mb.YTPlayer.js', array( 'jquery' ), $theme_info->get( 'Version' ), false );
$mods = get_theme_mods();
$enable_query_loader = !empty($mods['ascreen_option']['enable_query_loader']) ? $mods['ascreen_option']['enable_query_loader']:0;
if( $enable_query_loader == 1)
{
wp_enqueue_script( 'queryloader2', get_template_directory_uri().'/js/queryloader2.min.js', array( 'jquery' ), '', false );
wp_enqueue_script( 'ascreen-loader', get_template_directory_uri().'/js/loader.js', array( 'jquery' ), '', false );
}
wp_localize_script( 'ascreen-main', 'ascreen_params', array(
'ajaxurl' => admin_url('admin-ajax.php'),
'themeurl' => get_template_directory_uri(),
) );
}
add_action( 'wp_enqueue_scripts', 'ascreen_custom_scripts' );
/*
add widgets to wp-admin
*/
function ascreen_widgets_init() {
register_sidebar( array(
'name' => __('Sidebar','ascreen'),
'id' => 'sidebar',
'before_widget' => '
',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __('Footer Area #1','ascreen'),
'id' => 'sidebar-1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Area #2','ascreen'),
'id' => 'sidebar-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Area #3','ascreen'),
'id' => 'sidebar-3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Area #4','ascreen'),
'id' => 'sidebar-4',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '',
) );
}
add_action( 'widgets_init', 'ascreen_widgets_init' );
function ascreen_paging_nav(){
global $wp_query;
$pages = $wp_query->max_num_pages;
if ( $pages >= 2 ):
$big = 999999999;
$paginate = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'end_size' => 13,
'type' => 'array'
));
echo '';
endif;
}
function ascreen_better_comments($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
?>
id="li-comment-">
.
.
cat_ID;
$category->cat_name;
$cat_links=get_category_link($category->cat_ID );
?>
#cat_name);?>
cat_name;
$cat_ID = $categories->cat_ID;
}
$cat_links=get_category_link($cat_ID);
$str .= "#".esc_html($cat_name)."";
}
echo $str;
}
function ascreen_get_share_url()
{
$mods = get_theme_mods();
$twitter_url = !empty($mods['ascreen_option']['twitter_url']) ? $mods['ascreen_option']['twitter_url']:'#';
$google_plus_url = !empty($mods['ascreen_option']['google_plus_url']) ? $mods['ascreen_option']['google_plus_url']:'#';
$facebook_url = !empty($mods['ascreen_option']['facebook_url']) ? $mods['ascreen_option']['facebook_url']:'#';
?>
255 255 255
* @param string $hex Color Hex Code
* @return array RGB values
ascreen_hex2rgb( '#FFFFFF')
*/
function ascreen_hex2rgb( $hex )
{
if ( strpos( $hex,'rgb' ) !== FALSE )
{
$rgb_part = strstr( $hex, '(' );
$rgb_part = trim($rgb_part, '(' );
$rgb_part = rtrim($rgb_part, ')' );
$rgb_part = explode( ',', $rgb_part );
$rgb = array($rgb_part[0], $rgb_part[1], $rgb_part[2], $rgb_part[3]);
}
elseif( $hex == 'transparent' )
{
$rgb = array( '255', '255', '255', '0' );
}
else
{
$hex = str_replace( '#', '', $hex );
if( strlen( $hex ) == 3 )
{
$r = hexdec( substr( $hex, 0, 1 ) . substr( $hex, 0, 1 ) );
$g = hexdec( substr( $hex, 1, 1 ) . substr( $hex, 1, 1 ) );
$b = hexdec( substr( $hex, 2, 1 ) . substr( $hex, 2, 1 ) );
}
else
{
$r = hexdec( substr( $hex, 0, 2 ) );
$g = hexdec( substr( $hex, 2, 2 ) );
$b = hexdec( substr( $hex, 4, 2 ) );
}
$rgb = array( $r, $g, $b );
}
return $rgb; // returns an array with the rgb values
}
// Generating Live CSS
function ascreen_customize_css()
{
?>
esc_url( 'https://www.coothemes.com/themes/ascreen.php' ),
'upgrade_text' => __( 'Upgrade To Pro »', 'ascreen' ),
'WP_version' => get_bloginfo( 'version' ),
'old_version_message' => __( 'Some settings might be missing or disorganized in this version of WordPress. So we suggest you to upgrade to version 4.0 or better.', 'ascreen' )
);
if ( !(defined( 'ASCREEN_THEME_PRO_USED' ) && ASCREEN_THEME_PRO_USED ))
{
wp_localize_script( 'ascreen_customizer_custom', 'clean_box_misc_links', $clean_box_misc_links );
}
wp_enqueue_style( 'ascreen_customizer_custom_css', get_template_directory_uri() . '/css/customizer.css');
}
add_action( 'customize_controls_enqueue_scripts', 'ascreen_customize_scripts');
function ascreen_breadcrumbs() {
//$delimiter = 'ยป';
$delimiter = "»";
$before = '';
$after = '';
if ( !is_home() && !is_front_page() || is_paged() ) {
echo '';
global $post;
$homeLink = home_url();
echo '
' . __( 'Home' , 'ascreen' ) . ' ' . $delimiter . ' ';
if ( is_category() ) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0){
$cat_code = get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' ');
echo $cat_code = str_replace ('
' . get_the_time('Y') . ' ' . $delimiter . ' ';
echo '
' . get_the_time('F') . ' ' . $delimiter . ' ';
echo $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
echo '
' . get_the_time('Y') . ' ' . $delimiter . ' ';
echo $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
echo $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '
' . $post_type->labels->singular_name . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} else {
$cat = get_the_category(); $cat = $cat[0];
$cat_code = get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
echo $cat_code = str_replace ('
labels->singular_name . $after;
} elseif ( is_attachment() ) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
echo '' . $parent->post_title . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) {
echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '
' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif ( is_search() ) {
echo $before ;
printf( __( 'Search Results for: %s', 'ascreen' ), get_search_query() );
echo $after;
} elseif ( is_tag() ) {
echo $before ;
printf( __( 'Tag Archives: %s', 'ascreen' ), single_tag_title( '', false ) );
echo $after;
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata($author);
echo $before ;
printf( __( 'Author Archives: %s', 'ascreen' ), $userdata->display_name );
echo $after;
} elseif ( is_404() ) {
echo $before;
_e( 'Not Found', 'ascreen' );
echo $after;
}
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() )
echo sprintf( __( '( Page %s )', 'ascreen' ), get_query_var('paged') );
}
echo '
';
}
}