100, 'width' => 400, 'flex-width' => true, ) ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded 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' ), 'social' => esc_html__( 'Social Links Menu', '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' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="title widget-title"><span>', 'after_title' => '</span></h3>', ) ); } 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(); ?> <script type="text/javascript"> function angllia_blocks() {this.atts = '';this.url = '';} var angllia_<?php echo esc_html($angllia_key) ?> = new angllia_blocks(); angllia_<?php echo esc_html($angllia_key) ?>.query = '<?php echo str_replace( '\'', '\\\'', json_encode($angllia_query ) ); ?>'; angllia_<?php echo esc_html($angllia_key) ?>.atts = '<?php echo str_replace( '\'', '\\\'', json_encode($angllia_attr) ); ?>'; angllia_<?php echo esc_html($angllia_key) ?>.url = '<?php echo esc_html(admin_url( "admin-ajax.php" )); ?>'; </script> <?php echo ob_get_clean(); } function angllia_backend_enqueue() { wp_enqueue_style( 'angllia_custom_script', esc_url( get_template_directory_uri() ) .'/inc/css/style-backend.css' ); } add_action( 'admin_enqueue_scripts', 'angllia_backend_enqueue', 10000 ); /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; /* Translate */ function angllia_the_translate($text,$options_text) { $options_text = get_theme_mod($options_text); if($options_text) $text = $options_text; echo sanitize_text_field($text); } function angllia_get_translate($text,$options_text) { $options_text = get_theme_mod($options_text); if($options_text) $text = $options_text; return sanitize_text_field($text); } function angllia_get_my_widgets() { $sidebar_options = array( '0' => '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 = '<a><em><strong>', $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_mytheme_comment($comment, $args, $depth) { if ( 'div' == $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> <<?php echo $tag ?> <?php comment_class( empty( $args['has_children'] ) ? '' : 'parent' ) ?> id="comment-<?php comment_ID() ?>"> <?php if ( 'div' != $args['style'] ) : ?> <div id="div-comment-<?php comment_ID() ?>" class="media comment fully-inner-box"> <?php endif; ?> <div class="fully-media-left"> <?php if ( $args['avatar_size'] != 0 ) { echo get_avatar( $comment, $args['avatar_size'] ); } ?> </div> <div class="fully-media-body"> <?php if ( $comment->comment_approved == '0' ) : ?> <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.','angllia' ); ?></em> <br /> <?php endif; ?> <h5> <?php echo esc_html($comment->comment_author); ?> </h5> <?php comment_text(); ?> <span class="date-comment"><?php echo get_comment_date('d') .' . '. get_comment_date('M') .' . '. get_comment_date('Y') ?></span> <?php if ( is_user_logged_in() ){ ?> <?php comment_reply_link( array_merge( $args, array( 'add_below' => $add_below, 'reply_text' => 'Reply' ,'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?> <?php } ?> </div> <?php if ( 'div' != $args['style'] ) : ?> </div> <?php endif; } function angllia_no_set_menu() { if ( current_user_can('manage_options') ) { echo '<ul class="rst-nav-menu"><li><a href="'. admin_url( 'nav-menus.php' ) .'">'. esc_html__('Add Menu Here','angllia') .'</a></li></ul>'; } } function angllia_get_the_archive_title($before="",$after="") { if ( is_category() ) { $title = '<span>' . esc_html__('Browsing Category','angllia') .':</span> '. '<h2>' . single_cat_title( '', false ) . '</h2>'; } elseif ( is_tag() ) { $title = '<span>'. esc_html__('Browsing Tag','angllia') .':</span> '. '<h2>' . single_tag_title( '', false ) . '</h2>'; } elseif ( is_author() ) { $title = '<span>'. esc_html__('Author','angllia') .':</span> '. '<h2>' . single_tag_title( '', false ) . '</h2>'; } elseif ( is_year() ) { $title = '<span>'. esc_html__('Yearly Archives','angllia') .':</span> '. '<h2>' . get_the_date( 'Y') . '</h2>'; } elseif ( is_month() ) { $title = '<span>'. esc_html__('Monthly Archives','angllia') .':</span> '. '<h2>' . get_the_date( 'F Y') . '</h2>'; } elseif ( is_day() ) { $title = '<span>'. esc_html__('Daily Archives','angllia') .':</span> '. '<h2>' . get_the_date( 'F j, Y') . '</h2>'; } 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 = '<span>'. esc_html__('Archives','angllia') .':</span> ' . '<h2>' . post_type_archive_title( '', false ) . '</h2>'; } elseif ( is_tax() ) { $tax = get_taxonomy( get_queried_object()->taxonomy ); /* translators: 1: Taxonomy singular name, 2: Current taxonomy term */ $title = $tax->labels->singular_name. ': '. '<h2>' . single_term_title( '', false ) . '</h2>'; } else { $title = esc_html__('Archives','angllia'); } /** * 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' );