| Server IP : 103.48.194.25 / Your IP : 216.73.217.33 Web Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.33 System : Linux VMHostDefault 3.10.0-1160.42.2.el7.x86_64 #1 SMP Tue Sep 7 14:49:57 UTC 2021 x86_64 User : sieuthimay ( 1016) PHP Version : 8.2.20 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/sieuthimayasia.com/public_html/wp-content/themes/mtw-maycn/inc/ |
Upload File : |
<?php
/**
* Custom functions that act independently of the theme templates.
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package MTWTeam
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function mtwfn_body_classes( $classes ) {
// Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
// Adds a class of hfeed to non-singular pages.
if ( ! is_singular() ) {
$classes[] = 'hfeed';
}
return $classes;
}
add_filter( 'body_class', 'mtwfn_body_classes' );
/**
* Adds custom classes to the array of layout classes.
*
* @param array $classes Classes for the layout element.
*/
function mtwfn_layout_class( $classes = array() ) {
$classes = (array) $classes;
if ( MTW_Sidebar::has_sidebar() ) {
$classes[] = sprintf( 'sidebar-%s', MTW_Sidebar::get_sidebar_area() );
} else {
$classes[] = 'no-sidebar';
}
$classes = apply_filters( 'mtwfn_layout_class', $classes );
echo 'class="' . esc_attr( join( ' ', $classes ) ) . '"';
}
/**
* The excerpt length.
*/
function mtwfn_excerpt_length() {
return 65;
}
add_filter( 'excerpt_length', 'mtwfn_excerpt_length', 999 );
/**
* The excerpt more.
*
* @return sring
*/
function mtwfn_excerpt_more() {
return '… <a href="'. esc_url( get_the_permalink() ) .'" class="more-link">'. esc_html__( 'Xem thêm »', 'maycn' ).'</a>';
}
add_filter( 'excerpt_more', 'mtwfn_excerpt_more' );
if ( mtwfn_option( 'fb_sdk_js', null, false ) ) {
/**
* Include Facebook App ID on footer.
*
*/
function mtwfn_include_facebook_app_id() {
?>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/<?php mtwfn_option( 'fb_language' ); ?>/sdk.js#xfbml=1&version=v2.7&appId=<?php mtwfn_option( 'facebook_app_id' ); ?>";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<?php
}
add_action( 'wp_footer', 'mtwfn_include_facebook_app_id' );
}
/**
* Remove wp emojis.
*/
function mtwfn_disable_wp_emojicons() {
// all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
// filter to remove TinyMCE emojis
add_filter( 'tiny_mce_plugins', 'mtwfn_disable_emojicons_tinymce' );
add_filter( 'emoji_svg_url', '__return_false' );
}
add_action( 'init', 'mtwfn_disable_wp_emojicons' );
/**
* Remove wp emojis callback function.
*/
function mtwfn_disable_emojicons_tinymce( $plugins ) {
if ( is_array( $plugins ) ) {
return array_diff( $plugins, array( 'wpemoji' ) );
} else {
return array();
}
}