function get_post_content()
 {
     echo fusion_get_post_content('', 'yes', self::$args['excerpt_length'], self::$args['strip_html']);
 }
Example #2
0
 function avada_render_portfolio_post_content($page_id)
 {
     echo fusion_get_post_content($page_id, 'portfolio');
 }
Example #3
0
 function loop_content()
 {
     $content = fusion_get_post_content('', self::$args['excerpt'], self::$args['excerpt_words'], self::$args['strip_html']);
     $content = sprintf('<div class="fusion-post-content-container">%s</div>', $content);
     echo $content;
 }
Example #4
0
 /**
  * Render the parent shortcode
  * @param  array $args	 Shortcode paramters
  * @param  string $content Content between shortcode
  * @return string		  HTML output
  */
 function render($args, $content = '')
 {
     global $smof_data;
     $defaults = FusionCore_Plugin::set_shortcode_defaults(array('class' => '', 'id' => '', 'cat_id' => '', 'cat_slug' => '', 'columns' => 3, 'excerpt' => 'no', 'exclude_cats' => '', 'excerpt_length' => '', 'excerpt_words' => '15', 'layout' => 'default', 'meta' => 'yes', 'number_posts' => 4, 'offset' => '', 'strip_html' => 'yes', 'title' => 'yes', 'thumbnail' => 'yes', 'animation_direction' => 'left', 'animation_speed' => '', 'animation_type' => ''), $args);
     if ($defaults['columns'] > 6) {
         $defaults['columns'] = 6;
     }
     $defaults['strip_html'] == 'yes' || $defaults['strip_html'] == 'true' ? $defaults['strip_html'] = true : ($defaults['strip_html'] = false);
     if ($defaults['number_posts']) {
         $defaults['posts_per_page'] = $defaults['number_posts'];
     }
     if ($defaults['excerpt_length'] || $defaults['excerpt_length'] === '0') {
         $defaults['excerpt_words'] = $defaults['excerpt_length'];
     }
     //check for cats to exclude; needs to be checked via exclude_cats param and '-' prefixed cats on cats param
     //exclution via exclude_cats param
     $cats_to_exclude = explode(',', $defaults['exclude_cats']);
     if ($cats_to_exclude) {
         foreach ($cats_to_exclude as $cat_to_exclude) {
             $idObj = get_category_by_slug($cat_to_exclude);
             if ($idObj) {
                 $cats_id_to_exclude[] = $idObj->term_id;
             }
         }
         if (isset($cats_id_to_exclude) && $cats_id_to_exclude) {
             $defaults['category__not_in'] = $cats_id_to_exclude;
         }
     }
     //setting up cats to be used and exclution using '-' prefix on cats param; transform slugs to ids
     $cat_ids = '';
     $categories = explode(',', $defaults['cat_slug']);
     if (isset($categories) && $categories) {
         foreach ($categories as $category) {
             if ($category) {
                 $cat_obj = get_category_by_slug($category);
                 if (isset($cat_obj->term_id)) {
                     if (strpos($category, '-') === 0) {
                         $cat_ids .= '-' . $cat_obj->cat_ID . ',';
                     } else {
                         $cat_ids .= $cat_obj->cat_ID . ',';
                     }
                 }
             }
         }
     }
     $defaults['cat'] = substr($cat_ids, 0, -1);
     $defaults['cat'] .= $defaults['cat_id'];
     $items = '';
     $args = array('posts_per_page' => $defaults['number_posts'], 'ignore_sticky_posts' => 1);
     if ($defaults['offset']) {
         $args['offset'] = $defaults['offset'];
     }
     if ($defaults['cat']) {
         $args['cat'] = $defaults['cat'];
     }
     if (isset($defaults['category__not_in']) && is_array($defaults['category__not_in'])) {
         $args['category__not_in'] = $defaults['category__not_in'];
     }
     extract($defaults);
     self::$args = $defaults;
     $recent_posts = new WP_Query($args);
     $count = 1;
     while ($recent_posts->have_posts()) {
         $recent_posts->the_post();
         $attachment = $date_box = $slideshow = $slides = $content = '';
         if ($layout == 'date-on-side') {
             switch (get_post_format()) {
                 case 'gallery':
                     $format_class = 'images';
                     break;
                 case 'link':
                     $format_class = 'link';
                     break;
                 case 'image':
                     $format_class = 'image';
                     break;
                 case 'quote':
                     $format_class = 'quotes-left';
                     break;
                 case 'video':
                     $format_class = 'film';
                     break;
                 case 'audio':
                     $format_class = 'headphones';
                     break;
                 case 'chat':
                     $format_class = 'bubbles';
                     break;
                 default:
                     $format_class = 'pen';
                     break;
             }
             $date_box = sprintf('<div %s><div %s><span %s>%s</span><span %s>%s</span></div><div %s><i %s></i></div></div>', FusionCore_Plugin::attributes('fusion-date-and-formats'), FusionCore_Plugin::attributes('fusion-date-box updated'), FusionCore_Plugin::attributes('fusion-date'), get_the_time($smof_data['alternate_date_format_day']), FusionCore_Plugin::attributes('fusion-month-year'), get_the_time($smof_data['alternate_date_format_month_year']), FusionCore_Plugin::attributes('fusion-format-box'), FusionCore_Plugin::attributes('fusion-icon-' . $format_class));
         }
         if ($thumbnail == 'yes' && $layout != 'date-on-side' && !post_password_required(get_the_ID())) {
             if ($layout == 'default') {
                 $image_size = 'recent-posts';
             } elseif ($layout == 'thumbnails-on-side') {
                 $image_size = 'portfolio-five';
             }
             if (has_post_thumbnail() || get_post_meta(get_the_ID(), 'pyre_video', true)) {
                 if (get_post_meta(get_the_ID(), 'pyre_video', true)) {
                     $slides .= sprintf('<li><div %s>%s</div></li>', FusionCore_Plugin::attributes('full-video'), get_post_meta(get_the_ID(), 'pyre_video', true));
                 }
                 if (has_post_thumbnail()) {
                     $attachment_image = wp_get_attachment_image_src(get_post_thumbnail_id(), $image_size);
                     $full_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                     $attachment_data = wp_get_attachment_metadata(get_post_thumbnail_id());
                     $attachment = get_post(get_post_thumbnail_id());
                     $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => $attachment->post_title)));
                 }
                 $i = 2;
                 while ($i <= $smof_data['posts_slideshow_number']) {
                     $attachment_new_id = kd_mfi_get_featured_image_id('featured-image-' . $i, 'post');
                     if ($attachment_new_id) {
                         $attachment_image = wp_get_attachment_image_src($attachment_new_id, $image_size);
                         $full_image = wp_get_attachment_image_src($attachment_new_id, 'full');
                         $attachment_data = wp_get_attachment_metadata($attachment_new_id);
                         $slides .= sprintf('<li><a href="%s"><img %s/></a></li>', get_permalink(get_the_ID()), FusionCore_Plugin::attributes('recentposts-shortcode-img', array('src' => $attachment_image[0], 'alt' => '')));
                     }
                     $i++;
                 }
                 $slideshow = sprintf('<div %s><ul %s>%s</ul></div>', FusionCore_Plugin::attributes('recentposts-shortcode-slideshow'), FusionCore_Plugin::attributes('slides'), $slides);
             }
         }
         if ($title == 'yes') {
             $content .= avada_render_rich_snippets_for_pages(false);
             $entry_title = '';
             if (!$smof_data['disable_date_rich_snippet_pages']) {
                 $entry_title = 'entry-title';
             }
             $content .= sprintf('<h4 class="%s"><a href="%s">%s</a></h4>', $entry_title, get_permalink(get_the_ID()), get_the_title());
         } else {
             $content .= avada_render_rich_snippets_for_pages();
         }
         if ($meta == 'yes') {
             $comments = $comments_link = '';
             ob_start();
             comments_popup_link(__('0 Comments', 'fusion-core'), __('1 Comment', 'fusion-core'), '% ' . __('Comments', 'fusion-core'));
             $comments_link = ob_get_contents();
             ob_get_clean();
             $comments = sprintf('<span %s>|</span><span>%s</span>', FusionCore_Plugin::attributes('meta-separator'), $comments_link);
             $content .= sprintf('<p %s><span><span %s>%s</span></span>%s</p>', FusionCore_Plugin::attributes('meta'), FusionCore_Plugin::attributes('date'), get_the_time($smof_data['date_format'], get_the_ID()), $comments);
         }
         if ($excerpt == 'yes') {
             $content .= fusion_get_post_content('', 'yes', $excerpt_words, $strip_html);
         }
         if ($count == self::$args['columns']) {
             $count = 0;
             $items .= sprintf('<div %s>%s%s<div %s>%s</div></div><div class="fusion-clearfix"></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content);
         } else {
             $items .= sprintf('<div %s>%s%s<div %s>%s</div></div>', FusionCore_Plugin::attributes('recentposts-shortcode-column'), $date_box, $slideshow, FusionCore_Plugin::attributes('recent-posts-content'), $content);
         }
         $count++;
     }
     $html = sprintf('<div %s><section %s>%s</section></div>', FusionCore_Plugin::attributes('recentposts-shortcode'), FusionCore_Plugin::attributes('recentposts-shortcode-section'), $items);
     wp_reset_query();
     return $html;
 }
 function posts_excerpt()
 {
     $html = '';
     $args = array('posts_per_page' => self::$args['limit'], 'meta_query' => array(array('key' => '_thumbnail_id')));
     if (self::$args['post_id']) {
         $post_ids = explode(',', self::$args['post_id']);
         $args['post__in'] = $post_ids;
     }
     if (self::$args['category']) {
         $args['category_name'] = self::$args['category'];
     }
     $query = new WP_Query($args);
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $image = wp_get_attachment_url(get_post_thumbnail_id());
             $title = get_post_field('post_excerpt', get_post_thumbnail_id());
             $alt = get_the_title();
             $image_output = sprintf('<img src="%s" alt="%s" />', $image, get_the_title());
             $link_output = sprintf('<a href="%s">%s</a>', get_permalink(), $image_output);
             $title = sprintf('<h2><a href="%s">%s</a></h2>', get_permalink(), get_the_title());
             $excerpt = sprintf('%s', fusion_get_post_content('', 'yes', self::$args['excerpt'], true));
             $container = sprintf('<div %s><div %s>%s</div></div>', FusionCore_Plugin::attributes('flexslider-shortcode-title-container'), FusionCore_Plugin::attributes('excerpt-container'), $title . $excerpt);
             $html .= sprintf('<li>%s</li>', $link_output . $container);
         }
     } else {
     }
     wp_reset_query();
     return $html;
 }
 function avada_render_blog_post_content()
 {
     global $post;
     if ($post->post_type != "testimonial") {
         if (is_search() && Avada()->settings->get('search_excerpt')) {
             return;
         }
         echo fusion_get_post_content();
     }
 }