File: /home/agritom/domains/agritom.vn/public_html/wp-content/themes/flatsome-child/functions.php
<?php
// Add custom Theme Functions here
add_action('wp_footer','side_header_func');
function side_header_func(){
echo do_shortcode('[block id="side-header"]');
}
add_action('woocommerce_before_shop_loop_item','detail_icon');
function detail_icon(){
global $product;
echo '<div class="icon-ab">
<a href="'.$product->get_permalink().'" title="xem chi tiết" class="detail-icon"><i class="fas fa-info"></i></a>
<a class="quick-view" data-prod="'.$product->get_id().'" href="#quick-view" title="Xem nhanh"><i class="fas fa-search-plus"></i></a>
</div>
';
}
add_action('flatsome_blog_post_before','create_blog_author');
function create_blog_author(){
global $post;
?>
<div class="row align-middle row-collapse blog-home">
<div class="col medium-5 small-5 large-5">
<?php echo get_avatar( get_the_author_meta('email'), '60' ); ?>
<strong class="aut-name"><?php echo get_the_author(); ?></strong>
</div>
<div class="col medium-7 small-7 large-7">
<?php rebuild_isures_post(); ?>
</div>
</div>
<?php
}
function flatsome_posted_on(){
return apply_filters('flatsome_posted_on', 'rebuild_isures_post');
}
function rebuild_isures_post(){
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);
echo '<span><i class="fas fa-calendar-alt" style="margin-right: 10px;"></i>' . $time_string . '</span>';
}
add_action('flatsome_custom_single_product_1','hotline_dathangnhanh');
function hotline_dathangnhanh(){
if(is_singular('product')){
echo do_shortcode('[block id="hotline-in-single-product"]');
}
}
function add_this_script_footer()
{
global $woocommerce;
?>
<div id="fixed_cart" class="cart-item has-icon">
<a href="<?php echo wc_get_cart_url(); ?>" title="Giỏ hàng" class="header-cart-link off-canvas-toggle is-small" data-open="#cart-popup" data-class="off-canvas-cart" title="Giỏ hàng" data-pos="right"><div><i id="fixed_cart_icon" class="icon-shopping-bag" data-icon-label="<?php echo WC()->cart->get_cart_contents_count(); ?>"></i></div><span> Giỏ hàng</span></a>
</div>
<div id="cart-popup" class="mfp-hide widget_shopping_cart">
<div class="cart-popup-inner inner-padding">
<div class="cart-popup-title text-center">
<h4 class="uppercase">Giỏ hàng</h4>
<div class="is-divider"></div>
</div>
<div class="widget_shopping_cart_content"></div>
</div>
</div>
<?php
}
add_action('wp_footer', 'add_this_script_footer');
/* Code ẩn menu active license Flatsome */
/* Có mã bản quyền thì xóa đi để active */
add_action('admin_enqueue_scripts', 'ds_admin_theme_style');
add_action('login_enqueue_scripts', 'ds_admin_theme_style');
function ds_admin_theme_style()
{
echo '<style>#flatsome-notice, ul#wp-admin-bar-root-default li#wp-admin-bar-flatsome-activate , ul li#wp-admin-bar-flatsome_panel_license, #toplevel_page_flatsome-panel ul.wp-submenu.wp-submenu-wrap > li:nth-child(2), #toplevel_page_flatsome-panel ul.wp-submenu.wp-submenu-wrap > li:nth-child(3){ display: none; }</style>';
}
add_action( 'init', 'remove_fl_action' );
function remove_fl_action()
{
global $wp_filter;
remove_action( 'admin_notices', 'flatsome_maintenance_admin_notice' );
}
add_action( 'wp_head', function () {
echo '<style>#flatsome-notice, ul#wp-admin-bar-root-default li#wp-admin-bar-flatsome-activate , ul li#wp-admin-bar-flatsome_panel_license{ display: none; }</style>';
});
/* Code ẩn menu active license Flatsome */
/* Có mã bản quyền thì xóa đi để active */