?> <div class="one_fourth animated <?php echo esc_attr($eff); ?> delay-<?php echo esc_attr($i); ?> 00ms<?php if ($i % 4 == 0) { echo ' last'; } ?> "> <?php $img = king::get_featured_image($post); echo '<img src="' . king_createLinkImage($img, '250x250xc') . '" class="cirimg" alt="" />'; ?> <div class="cinfo"> <img src="<?php echo esc_url(THEME_URI . '/assets/images/shape1.jpg'); ?> " alt="" class="shape1"> <h5><?php the_title(); ?> </h5> <em><?php echo esc_html($options['position']); ?> </em>
public static function king_posts($atts = null, $content = null) { global $king; $atts = shortcode_atts(array('items' => 20, 'category' => '', 'per_row' => 4, 'class' => '', 'cl_class' => '', 'words' => 20, 'img_size' => '245x245', 'format' => '', 'post_type' => 'post', 'taxonomy' => 'category', 'order' => 'DESC'), $atts, 'faq'); $atts['format'] = rawurldecode($king->ext['bd'](strip_tags($atts['format']))); $posts = self::get_posts($atts); if (!count($posts)) { return '<h4>' . __('Article not found', KING_DOMAIN) . '</h4> <a href="' . admin_url('post-new.php') . '"><i class="fa fa-plus"></i> Add New Article</a>'; } $eff = rand(0, 10); if ($eff <= 2) { $eff = 'eff-fadeInUp'; } else { if ($eff > 2 && $eff <= 4) { $eff = 'eff-fadeInRight'; } else { if ($eff > 4 && $eff <= 8) { $eff = 'eff-fadeInLeft'; } else { $eff = 'eff-flipInY'; } } } $columns = array('1' => 'one_full', '2' => 'one_half', '3' => 'one_third', '4' => 'one_fourth', '5' => 'one_fifth'); $_return = ''; if (!empty($atts['class'])) { $_return = '<div class="' . esc_attr($atts['class']) . '">'; } $i = 1; foreach ($posts as $post) { $title = esc_html($post->post_title); $des = esc_html(wp_trim_words($post->post_content, $atts['words'])); $img_size = explode('x', $atts['img_size']); $_w = intval(!empty($img_size[0]) ? $img_size[0] : 245); $_h = intval(!empty($img_size[1]) ? $img_size[1] : 245); $_a = !empty($img_size[2]) ? esc_attr($img_size[2]) : 'c'; $categories_list = get_the_category_list(__(', ', KING_DOMAIN), '', $post->ID); $categories = explode(',', $categories_list); if (count($categories) == 1) { $categories = $categories_list; } else { if (count($categories) > 1) { $categories_list = ''; foreach ($categories as $categorie) { if (strpos($categorie, 'Uncategorized') === false) { $categories_list .= $categorie . ', '; } } $categories_list .= '.'; $categories = str_replace(', .', '', $categories_list); } else { $categories = $categories_list; } } $img = king_createLinkImage(king::get_featured_image($post), $_w . 'x' . $_h . 'x' . $_a); $link = get_permalink($post->ID); $_return .= '<div class="animated delay-' . $i . '00ms ' . $eff; if ($i % $atts['per_row'] == 0) { $_return .= ' last '; } if (empty($atts['cl_class'])) { $_return .= ' ' . esc_attr($columns[$atts['per_row']]); } else { $_return .= ' ' . $atts['cl_class']; } $_return .= '">'; $_return .= str_replace(array('{title}', '{img}', '{des}', '{link}', '{category}'), array($title, $img, $des, $link, $categories), $atts['format']); $_return .= '</div>'; $i++; } if (!empty($atts['class'])) { $_return .= '</div>'; } return do_shortcode($_return); }