tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
add_theme_support( 'custom-background' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'angllia-list', '650', '430', true );
add_image_size( 'angllia-grid', '740', '520', true );
add_image_size( 'angllia-large', '1170', '700', true );
add_image_size( 'angllia-recent-post', '90', '80', true );
add_image_size( 'angllia-box', '650', '430', true );
add_image_size( 'angllia-slider', '1170', '500', true );
}
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'angllia' ),
'menu_footer' => esc_html__( 'Menu Footer', 'angllia' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
));
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'image', 'video', 'audio', 'quote', 'gallery',
) );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function angllia_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'angllia' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'angllia_widgets_init' );
/*
* Function Get Widgets
*/
function angllia_get_widgets() {
$sidebar_options = array(
'0' => esc_html__('Select Sidebar','angllia')
);
foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
$sidebar_options[$sidebar['id']] = $sidebar['name'];
}
return $sidebar_options;
}
add_action('init','angllia_get_widgets', 5);
/**
* Enqueue scripts and styles.
*/
function angllia_scripts() {
wp_enqueue_style( 'angllia-bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'angllia-jasny-bootstrap', get_template_directory_uri() . '/css/jasny-bootstrap.min.css' );
wp_enqueue_style( 'angllia-font-awesome', get_template_directory_uri() . '/font-awesome-4.2.0/css/font-awesome.css' );
wp_enqueue_style( 'angllia-font-fontello', get_template_directory_uri() . '/css/fontello/fontello.css' );
wp_enqueue_style( 'angllia-effect2', get_template_directory_uri() . '/css/effect2.css' );
wp_enqueue_style( 'angllia-animate', get_template_directory_uri() . '/css/animate.css' );
wp_enqueue_style( 'angllia-selectbox', get_template_directory_uri() . '/rslib/scripts/jquery.rs.selectbox/jquery.rs.selectbox.css' );
wp_enqueue_style( 'angllia-slider-pro', get_template_directory_uri() . '/js/slider-pro/slider-pro.min.css' );
wp_enqueue_style( 'angllia-slick', get_template_directory_uri() . '/js/slick/slick.css' );
wp_enqueue_style( 'angllia-owl-carousel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.css' );
wp_enqueue_style( 'angllia-rs-wp-v1.2', get_template_directory_uri() . '/css/rs-wp-v1.2.css' );
wp_enqueue_style( 'angllia-main', get_template_directory_uri() . '/css/main.css' );
wp_enqueue_style( 'angllia-responsive', get_template_directory_uri() . '/css/responsive.css' );
wp_enqueue_style( 'angllia-style', get_stylesheet_uri() );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'angllia-default', get_template_directory_uri() . '/js/default.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-jquery.stickit', get_template_directory_uri() . '/js/jquery.stickit.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-isotope', get_template_directory_uri() . '/js/isotope.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-wow.min', get_template_directory_uri() . '/js/wow.min.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-selectbox', get_template_directory_uri() . '/rslib/scripts/jquery.rs.selectbox/jquery.rs.selectbox.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-appear', get_template_directory_uri() . '/js/appear.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-jquery.easing.1.3', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-slick', get_template_directory_uri() . '/js/slick/slick.min.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-slider-pro', get_template_directory_uri() . '/js/slider-pro/jquery.sliderPro.min.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-owl-carousel', get_template_directory_uri() . '/js/owl-carousel/owl.carousel.min.js', 'jquery', '', true );
wp_enqueue_script( 'angllia-main', get_template_directory_uri() . '/js/main.js', 'jquery', '', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_localize_script( 'angllia-js-custom', 'fully_main', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'themeurl' => get_template_directory_uri(),
'homeurl' => home_url("/"),
));
}
add_action( 'wp_enqueue_scripts', 'angllia_scripts' );
add_filter( 'mce_css', 'angllia_editor_style');
function angllia_editor_style($mce_css) {
if ( ! empty( $mce_css ) )
$mce_css .= ',';
$style_uri = get_stylesheet_directory_uri();
$style_dir = get_stylesheet_directory();
//$mce_css = array();
$mce_css .= add_query_arg(
'version',
filemtime( "$style_dir/rst-writerEditorCSS.min.css" ),
"$style_uri/rst-writerEditorCSS.min.css"
);
return $mce_css;
}
function angllia_fonts_url() {
$fonts_url = '';
$Playfair = _x( 'on', 'Playfair Display font: on or off', 'angllia' );
$Montserrat = _x( 'on', 'Montserrat font: on or off', 'angllia' );
$Cantata_one = _x( 'on', 'Cantata+One font: on or off', 'angllia' );
$Limelight = _x( 'on', 'Limelight font: on or off', 'angllia' );
$Chivo = _x( 'on', 'Chivo font: on or off', 'angllia' );
$Merriweather = _x( 'on', 'Merriweather font: on or off', 'angllia' );
$Droid_serif = _x( 'on', 'Droid+Serif font: on or off', 'angllia' );
$Old_standard = _x( 'on', 'Old+Standard+TT font: on or off', 'angllia' );
$Ptsans = _x( 'on', 'PT Sans font: on or off', 'angllia' );
$open_sans = _x( 'on', 'Open Sans font: on or off', 'angllia' );
$Dawning = _x( 'on', 'Dawning font: on or off', 'angllia' );
$lato = _x( 'on', 'Lato font: on or off', 'angllia' );
if ( 'off' !== $Chivo || 'off' !== $Limelight || 'off' !== $Cantata_one || 'off' !== $Montserrat || 'off' !== $Dawning || 'off' !== $Playfair || 'off' !== $Droid_serif || 'off' !== $Old_standard || 'off' !== $Ptsans || 'off' !== $open_sans || 'off' !== $Merriweather || 'off' !== $lato ) {
$font_families = array();
if ( 'off' !== $Montserrat ) {
$font_families[] = 'Montserrat';
}
if ( 'off' !== $Chivo ) {
$font_families[] = 'Chivo';
}
if ( 'off' !== $Limelight ) {
$font_families[] = 'Limelight';
}
if ( 'off' !== $Cantata_one ) {
$font_families[] = 'Cantata One';
}
if ( 'off' !== $Dawning ) {
$font_families[] = 'Dawning of a New Day';
}
if ( 'off' !== $Playfair ) {
$font_families[] = 'Playfair Display:400,400italic,700,700italic';
}
if ( 'off' !== $Merriweather ) {
$font_families[] = 'Merriweather:400,400italic';
}
if ( 'off' !== $Droid_serif ) {
$font_families[] = 'Droid Serif:400,400italic,700';
}
if ( 'off' !== $Old_standard ) {
$font_families[] = 'Old Standard TT:400,400italic,700';
}
if ( 'off' !== $Ptsans ) {
$font_families[] = 'PT Sans:400,700,400italic,700italic';
}
if ( 'off' !== $open_sans ) {
$font_families[] = 'Open Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,vietnamese';
}
if ( 'off' !== $lato ) {
$font_families[] = 'Lato:400,700,300,100,300italic,400italic,700italic';
}
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
add_editor_style( str_replace( ',', '%2C', $fonts_url ) );
return esc_url_raw( $fonts_url );
}
function angllia_slug_scripts_styles() {
wp_enqueue_style( 'angllia-fonts', angllia_fonts_url(), array(), null );
}
add_action( 'wp_enqueue_scripts', 'angllia_slug_scripts_styles' );
add_action( 'admin_enqueue_scripts', 'angllia_slug_scripts_styles' );
function angllia_render_script_ajax_block($angllia_query, $angllia_attr, $angllia_key) {
ob_start();
?>
'Select Sidebar'
);
foreach ($GLOBALS['wp_registered_sidebars'] as $sidebar) {
$sidebar_options[$sidebar['id']] = $sidebar['name'];
}
return $sidebar_options;
}
add_action('init','angllia_get_my_widgets');
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
function angllia_get_attachment_image_src( $attributes_id, $size ){
$attributes = wp_get_attachment_image_src( $attributes_id, $size );
return $attributes[0];
}
/*
* Function Get Excerpt
*/
function angllia_get_excerpt_by_id($post, $length = 0, $tags = '', $extra = '...') {
if(is_int($post)) {
$post = get_post($post);
} elseif(!is_object($post)) {
return false;
}
if( is_object($post) ) setup_postdata($post);
if($length == 0) return apply_filters('the_content', $post->post_content);
// $the_excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt );
$the_excerpt = ( empty($post->post_excerpt) ) ? $post->post_content : $post->post_excerpt;
$the_excerpt = strip_shortcodes(strip_tags($the_excerpt), $tags);
$the_excerpt = preg_split('/\b/', $the_excerpt, $length * 2+1);
$excerpt_waste = array_pop($the_excerpt);
$the_excerpt = implode($the_excerpt);
$the_excerpt = trim($the_excerpt);
$the_excerpt = str_replace("\n","",$the_excerpt);
$the_excerpt = str_replace("\r","",$the_excerpt);
if( $the_excerpt != '' )
$the_excerpt .= $extra;
wp_reset_postdata();
return apply_filters('the_content', $the_excerpt);
}
if(!function_exists('angllia_crop_content')) {
function angllia_crop_content($input = "", $number = 9999){
if(!is_int($number))
$number=999;
if($input!=""){
if($number==""){
return $input;
}
else{
$array_crop_content = array();
$array_crop_content = explode(" ", $input);
$result_content = '';
for($i=0; $i<$number; $i++){
if(isset($array_crop_content[$i])){
$result_content .= $array_crop_content[$i] . " ";
}
}
return $result_content;
}
}
else
return "";
}
}
add_action('init','angllia_get_excerpt_by_id');
function angllia_get_template_part( $slug, $name="" ) {
ob_start();
get_template_part( $slug, $name );
return ob_get_clean();
}
function angllia_no_set_menu() {
if ( current_user_can('manage_options') ) {
echo '';
}
}
function angllia_get_the_archive_title($before="",$after="") {
if ( is_category() ) {
$title = '' . angllia_get_translate('Browsing Category','translation_category') .': '. '' . single_cat_title( '', false ) . '
';
} elseif ( is_tag() ) {
$title = ''. angllia_get_translate('Browsing Tag','browsing_tag') .': '. '' . single_tag_title( '', false ) . '
';
} elseif ( is_author() ) {
$title = ''. angllia_get_translate('Author','translation_author') .': '. '' . single_tag_title( '', false ) . '
';
} elseif ( is_year() ) {
$title = ''. angllia_get_translate('Yearly Archives','yearly_archives').': '. '' . get_the_date( 'Y') . '
';
} elseif ( is_month() ) {
$title = ''. angllia_get_translate('Monthly Archives','monthly_archives').': '. '' . get_the_date( 'F Y') . '
';
} elseif ( is_day() ) {
$title = ''. angllia_get_translate('Daily Archives','daily_archives').': '. '' . get_the_date( 'F j, Y') . '
';
} elseif ( is_tax( 'post_format' ) ) {
if ( is_tax( 'post_format', 'post-format-aside' ) ) {
$title = 'Asides';
} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
$title = 'Galleries';
} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
$title = 'Images';
} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
$title = 'Videos';
} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
$title = 'Quotes';
} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
$title = 'Links';
} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
$title = 'Statuses';
} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
$title = 'Audio';
} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
$title = 'Chats';
}
} elseif ( is_post_type_archive() ) {
$title = ''.angllia_get_translate('Archives','translation_archives') .': ' . '' . post_type_archive_title( '', false ) . '
';
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
$title = $tax->labels->singular_name. ': '. '' . single_term_title( '', false ) . '
';
} else {
$title = angllia_get_translate('Archives','translation_archives');
}
/**
* Filter the archive title.
*
* @since 4.1.0
*
* @param string $title Archive title to be displayed.
*/
return apply_filters( 'get_the_archive_title', $before.$title.$after );
}
add_filter( 'request', 'angllia_alter_the_query' );
function angllia_alter_the_query( $request ) {
if( isset($request['paged']) && !(is_admin()) ){
$request['posts_per_page'] = 1;
}
return $request;
}
}
endif;
add_action( 'after_setup_theme', 'angllia_setup' );