HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/shoetique/wp-content/themes/north-wp/vc_templates/thb_post.php
<?php function thb_post( $atts, $content = null ) {
   $atts = vc_map_get_attributes( 'thb_post', $atts );
   extract( $atts );
    
	$args = array(
		'showposts' => $item_count, 
		'nopaging' => 0, 
		'post_type'=>'post', 
		'post_status' => 'publish', 
		'ignore_sticky_posts' => 1,
		'no_found_rows' => true,
		'suppress_filters' => 0
	);
	
	if (!empty($cat)) {
		$cats = explode(',',$cat);
		$args = wp_parse_args( array('category__in' => $cats), $args );	
	}

	$posts = new WP_Query( $args );
 	
 	ob_start();
 	
	if ( $posts->have_posts() ) { ?>
	  <?php switch($columns) {
	  	case 2:
	  		$col = 'medium-6';
	  		$w = '570';
	  		break;
	  	case 3:
	  		$col = 'medium-4';
	  		$w = '370';
	  		break;
	  	case 4:
	  		$col = 'medium-3';
	  		$w = '270';
	  		break;
	  } ?>
		<?php if ($carousel == "yes") { ?>
			
				<div class="carousel posts owl row" data-columns="<?php echo $columns; ?>" data-navigation="true" data-bgcheck="false">				
					
					<?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
						<article <?php post_class('post '.$col.' columns'); ?> id="post-<?php the_ID(); ?>">
							<?php
							  $masonry = 0;
							  include(locate_template( 'inc/postformats/image.php' ));
							?>
							  <div class="post-title">
							  	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
							  </div>
							  <div class="post-content">
							  	<?php echo thb_ShortenText(get_the_content(), 200); ?>
							  </div>
								<?php get_template_part( 'inc/postformats/post-meta-masonry' ); ?>
						</article>
					<?php endwhile; // end of the loop. ?>	 
										
				</div>
			
		<?php } else {  ?> 
		<div class="masonry posts row" data-equal="article">
		
			<?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
				<article <?php post_class('small-4 columns post item'); ?> id="post-<?php the_ID(); ?>">
				  <?php
					$masonry = 0;
				    include(locate_template( 'inc/postformats/image.php' ));
				  ?>
				    <div class="post-title">
				    	<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
				    </div>
				    <div class="post-content">
				    	<?php echo thb_ShortenText(get_the_content(), 200); ?>
				    </div>
				  	<?php get_template_part( 'inc/postformats/post-meta-masonry' ); ?>
				</article>
			<?php endwhile; // end of the loop. ?>
		 
		</div>
		
		<?php } ?>
	   
	<?php }

   $out = ob_get_contents();
   if (ob_get_contents()) ob_end_clean();
   
   wp_reset_query();
   wp_reset_postdata();
     
  return $out;
}
add_shortcode('thb_post', 'thb_post');