use do_shortcode() in post_html
-
<?php
function truyen_hot_shortcode($atts) {
// L?y tham s? num t? shortcode, m?c ??nh là 5
$atts = shortcode_atts(array(
'num' => 5,
), $atts, 'truyen_hot');
// B?t ??u xay d?ng output HTML
ob_start();
if (function_exists('wpp_get_mostpopular')) {
// G?i wpp_get_mostpopular() và s? d?ng post_html ?? ??nh d?ng HTML cho t?ng bài vi?t
wpp_get_mostpopular(array(
'limit' => intval($atts['num']),
'range' => 'all',
'order_by' => 'views',
'post_type' => 'post',
'stats_views' => 1,
'thumbnail_width' => 158,
'thumbnail_height' => 258,
'wpp_start' => '<div uk-slider="autoplay: 1; autoplayInterval: 3000;" class="uk-margin uk-text-center uk-slider uk-slider-container" role="region" aria-roledescription="carousel"><div class="uk-position-relative"><ul class="uk-slider-items uk-grid uk-grid-small uk-grid-match" aria-live="off" role="presentation">',
'wpp_end' => '</ul></div></div>',
'post_html' => '
<li class="uk-active" aria-hidden="false">
<div class="el-item uk-grid-item-match">
<a class="uk-cover-container uk-transition-toggle uk-display-block uk-link-toggle" href="{url}">
<img src="{thumb_url}" width="158" height="258" class="el-image uk-transition-scale-up uk-transition-opaque uk-object-cover" uk-cover="">
<div class="uk-position-bottom-center uk-overlay-primary">
<div class="uk-overlay uk-padding-remove uk-margin-remove-first-child">
<h3 class="el-title uk-h5 uk-margin-top uk-margin-remove-bottom">{text_title}</h3>
<div class="el-meta uk-text-emphasis">
' . do_shortcode('[count_chap post_id="{pid}"]') . ', {views} l??t xem
</div>
</div>
</div>
</a>
</div>
</li>',
'default_thumbnail' => get_stylesheet_directory_uri() . '/images/Chua-co-anh-bia.png', // ?nh m?c ??nh n?u kh?ng có thumbnail
));
} else {
echo "<!-- Plugin WordPress Popular Posts kh?ng ho?t ??ng -->";
}
return ob_get_clean();
}
add_shortcode('truyen_hot', 'truyen_hot_shortcode');
?>i want to use ‘ . do_shortcode(‘[count_chap post_id=”{pid}”]’) . ‘ in post_html but it seems it doesn’t receive the {pid} as expected
The page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.