• Hello there,

    I was wondering how I could get Advanced Excerpt working with Visual Composers “Latest Posts”. I just can′t seem to get it to work, for some reason I can only find “get_the_content” within the “Latest Posts” function. If i change this to “the_content”, my whole theme crashes.

    Does any1 know how to get it to work?

    Thanks.

    https://www.ads-software.com/plugins/advanced-excerpt/

Viewing 1 replies (of 1 total)
  • Thread Starter stuffen17

    (@stuffen17)

    $latest_posts = new WP_Query($args);
    
    		$output = 	'<div class="w-shortblog '.' date_atleft'.$attributes['el_class'].'">
    							<div class="w-shortblog-h">
    								<div class="w-shortblog-list">';
    		global $disable_section_shortcode, $post;
    		$disable_section_shortcode_tmp = $disable_section_shortcode;
    		$disable_section_shortcode = TRUE;
    		while($latest_posts->have_posts())
    		{
    			$latest_posts->the_post();
    
    			$excerpt = $post->post_excerpt;
    			if ($excerpt == '') {
    				$excerpt = get_the_content(get_the_ID());
    				$excerpt = do_shortcode($excerpt);
    				$excerpt = $this->sections_fix($excerpt);
    
    				$excerpt = apply_filters('the_excerpt', $excerpt);
    				$excerpt = str_replace(']]>', ']]>', $excerpt);
    				$excerpt_length = apply_filters('excerpt_length', 55);
    				$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
    				$excerpt = wp_trim_words( $excerpt, $excerpt_length, $excerpt_more );
    			} else {
    				$excerpt = apply_filters('the_excerpt', $excerpt);
    				$excerpt = str_replace(']]>', ']]>', $excerpt);
    			}
    
    			$output .= 				'<div class="w-shortblog-entry">
    										<div class="w-shortblog-entry-h">
    											<a class="w-shortblog-entry-link" href="'.get_permalink(get_the_ID()).'">
    												<h4 class="w-shortblog-entry-title">
    													<span class="w-shortblog-entry-title-h">'.get_the_title().'</span>
    												</h4>
    											</a>
    											<div class="w-shortblog-entry-meta">
    												<div class="w-shortblog-entry-meta-date">
    													<span class="w-shortblog-entry-meta-date-month">'.get_the_date('M').'</span>
    										<span class="w-shortblog-entry-meta-date-day">'.get_the_date('d').'</span>
    										<span class="w-shortblog-entry-meta-date-year">'.get_the_date('Y').'</span>
    												</div>
    											</div>
    											<div class="w-shortblog-entry-short">
    											'.$excerpt.'
    											</div>
    										</div>
    									</div>';
    		}
    		$output .=				'</div>
    							</div>
    						</div>';
    		$disable_section_shortcode = $disable_section_shortcode_tmp;
    		wp_reset_query();

    This is the code that is beeing used by vc_latest_posts.

Viewing 1 replies (of 1 total)
  • The topic ‘Visual Composer Compatibility’ is closed to new replies.