HEX
Server: LiteSpeed
System: Linux osault1.hostarmada.net 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: tucom (1048)
PHP: 8.4.24
Disabled: NONE
Upload Files
File: /home2/tucom/minecraftmienphi.com/wp-content/themes/flatsome/functions.php
<?php
/**
 * Flatsome functions and definitions
 *
 * @package flatsome
 */

require get_template_directory() . '/inc/init.php';

flatsome()->init();

/**
 * It's not recommended to add any custom code here. Please use a child theme
 * so that your customizations aren't lost during updates.
 *
 * Learn more here: https://developer.wordpress.org/themes/advanced-topics/child-themes/
 */
/* APK DOWNLOAD BUTTON - BOXED 700PX */

function apk_download_btn($atts){

$atts = shortcode_atts(array(
'name' => 'Download APK',
'link' => '#',
'time' => '8'
), $atts);

ob_start(); ?>

<div class="apk-widget">

<button class="apk-btn-start"
data-time="<?php echo esc_attr($atts['time']); ?>">

<span class="apk-label"><?php echo esc_html($atts['name']); ?></span>

<span class="apk-loading">
Creating link... <b class="apk-count"><?php echo esc_html($atts['time']); ?></b>s
</span>

</button>

<a href="<?php echo esc_url($atts['link']); ?>"
class="apk-btn-real"
target="_blank"
rel="nofollow noopener">

Download Now

</a>

</div>

<?php
return ob_get_clean();
}

add_shortcode('apk_download','apk_download_btn');


add_action('wp_footer',function(){ ?>

<style>

.apk-widget{
max-width:700px;
margin:25px auto;
text-align:center;
}

.apk-btn-start,
.apk-btn-real{
display:block;
width:100%;
padding:16px;
font-size:18px;
font-weight:700;
border-radius:10px;
text-decoration:none!important;
border:none;
cursor:pointer;
color:#fff!important;
}

.apk-btn-start{
background:linear-gradient(135deg,#1b8adb,#1765a3);
}

.apk-btn-real{
background:linear-gradient(135deg,#2ecc71,#27ae60);
display:none;
}

.apk-btn-start.loading{
background:#eef2f7;
color:#6b7280!important;
pointer-events:none;
}

.apk-loading{
display:none;
}

</style>

<script>

document.addEventListener("click",function(e){

let btn = e.target.closest(".apk-btn-start");

if(!btn) return;

let box = btn.closest(".apk-widget");
let real = box.querySelector(".apk-btn-real");

let label = btn.querySelector(".apk-label");
let loading = btn.querySelector(".apk-loading");
let count = btn.querySelector(".apk-count");

btn.classList.add("loading");

label.style.display="none";
loading.style.display="inline";

let time=parseInt(btn.dataset.time);

count.textContent=time;

let timer=setInterval(function(){

time--;
count.textContent=time;

if(time<=0){

clearInterval(timer);

btn.style.display="none";
real.style.display="block";

}

},1000);

});

</script>

<?php });
/* APK VERSION LIST PRO */

function apk_versions_pro_shortcode($atts){

$atts = shortcode_atts(array(
'ids' => '',
'limit' => 10
), $atts);

$ids = explode(',', $atts['ids']);

$args = array(
'post_type' => 'post',
'post__in' => $ids,
'orderby' => 'post__in',
'posts_per_page' => $atts['limit']
);

$query = new WP_Query($args);

$total = count($ids);

ob_start();

if($query->have_posts()): ?>

<div class="apkpro-list">

<?php while($query->have_posts()): $query->the_post(); ?>

<div class="apkpro-item">

<div class="apkpro-thumb">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('thumbnail'); ?>
</a>
</div>

<div class="apkpro-info">

<h3 class="apkpro-title">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>

<div class="apkpro-desc">
<?php echo wp_trim_words(get_the_excerpt(),12); ?>
</div>

<div class="apkpro-tags">
<span class="tag-apk">APK</span>
<span>Miễn Phí</span>
<span>Tiếng Việt</span>
</div>

</div>

<div class="apkpro-download">
<a href="<?php the_permalink(); ?>" class="apkpro-btn">
Tải ngay
</a>
</div>

</div>

<?php endwhile; ?>

</div>

<?php if($total > $atts['limit']) : ?>

<div class="apkpro-more">
<span>PHIÊN BẢN KHÁC (+<?php echo $total - $atts['limit']; ?>)</span>
</div>

<?php endif; ?>

<?php endif;

wp_reset_postdata();

return ob_get_clean();

}

add_shortcode('apk_versions_pro','apk_versions_pro_shortcode');