| Server IP : 213.186.33.2 / Your IP : 216.73.216.39 Web Server : Apache System : Linux webm005.cluster102.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : symetry ( 21728) PHP Version : 8.2.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/symetry/www/wp-content/plugins/popularis-extra/library/extra-shortcodes/ |
Upload File : |
<?php
// Exit if accessed directly.
if (!defined('ABSPATH')) {
exit;
}
/*
|----------------------------------------------------------
| Posts
|----------------------------------------------------------
*/
add_shortcode('popularis-posts', 'popularis_extra_posts_carousel_shortcode');
function popularis_extra_posts_carousel_shortcode($atts, $content = null) {
STATIC $i = 1;
extract(shortcode_atts(array(
'text_color' => '', // Theme default
'columns' => '3', // 3* / 2 / 3 / 4 / 5
'limit' => '6', // *6
'category' => '', // Category ID
), $atts, 'popularis-posts'));
$category = explode(',', $category);
if (empty($category)) {
return;
}
$columns = 12 / $columns;
// setup query
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$post_args = array(
'posts_per_page' => $limit,
'cat' => $category,
'ignore_sticky_posts' => 1,
'paged' => $paged,
);
// query database
$post = new WP_Query($post_args);
ob_start();
?>
<div id="popularis-posts-shortcode-<?php echo absint($i); ?>" class="popularis-posts-shortcode" >
<?php if ($post->have_posts()) : ?>
<div class="row" >
<?php while ($post->have_posts()) : ?>
<?php $post->the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('col-md-' . absint($columns)); ?>>
<div class="news-item text-center">
<?php the_post_thumbnail(); ?>
<div class="news-text-wrap">
<?php the_title('<h2 class="entry-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark" style="color: ' . esc_attr($text_color) . '">', '</a></h2>'); ?>
<div class="f-line"></div>
<div class="post-excerpt" style="color: <?php echo esc_attr($text_color) ?>">
<?php the_excerpt(); ?>
</div><!-- .post-excerpt -->
</div><!-- .news-text-wrap -->
</div><!-- .news-item -->
</article>
<?php endwhile; ?>
</div><!-- .row -->
<?php endif; ?>
</div>
<?php
wp_reset_postdata();
$i++;
return ob_get_clean();
}