• Hi, I’ve a real estate website, the theme came with Jcarousel, on the bottom of the landing page it shows a slider that displays recent properties. The problem I’m having is its showing all the property posts (around 700 of them) in the Jcarousel, sorted by most recent, waiting to scroll.

    Is there a way I can limit this to most recent and limit it to the last 15 or 20 posts? I think this is the code that needs to be altered:

    
    <div class=&quot;container carousel-wrapper&quot;>
    			<div id=&quot;recent-title-listing&quot; class=&quot;container&quot;>
    				<div class=&quot;recent-property-list-title&quot;><?php echo __( 'Recent Properties', 'realexpert' ); ?></div>
    				<div class=&quot;recent-property-list-by&quot;>
    					<div class=&quot;jcarousel-control&quot;>
    						<a href=&quot;#&quot;>
    							<span class=&quot;icon-stack&quot;>
    							  <i class=&quot;icon-stop icon-stack-base&quot;></i>
    							  <i class=&quot;icon-chevron-left&quot;></i>
    							</span>
    						</a>
    						<a href=&quot;#&quot;>
    							<span class=&quot;icon-stack&quot;>
    							  <i class=&quot;icon-stop icon-stack-base&quot;></i>
    							  <i class=&quot;icon-chevron-right&quot;></i>
    							</span>
    						</a>
    					</div>
    				</div>
    			</div><!-- /#title-listing -->
    			<div class=&quot;jcarousel container&quot;>
    				<div class=&quot;jcontainer&quot; <?php if(is_rtl()){ ?>dir=&quot;rtl&quot;<?php } ?>>
    		<?php
    			$args = array(
    				'post_type' => 'property',
    				'orderby' => 'post_date',
    				'posts_per_page' => -1,
    				//'tax_query' => array( array('taxonomy' => 'property-type','field' => 'slug','terms' => $type ),),
    			);
    			$property = new WP_Query( $args );
    			if( $property->have_posts() ):
    				while( $property->have_posts() ): $property->the_post();
    				?>
    					<div class=&quot;span3&quot;>
    						<article class=&quot;property-item&quot;>
    						<?php
    							$class_status = '';
    							$status_terms = get_the_terms( $post->ID, &quot;property-status&quot; );
    							if(!empty( $status_terms )){
    								foreach( $status_terms as $status_term ){
    									$property_status = $status_term->name;
    									$status_id = $status_term->term_id;
    								}
    							}
    						?>
    						<div class=&quot;property-images status-<?php echo $status_id; ?>&quot;>
    						<?php
    							echo '<a href=&quot;'.get_permalink().'&quot; title=&quot;'.get_the_title().'&quot;>';
    							if( has_post_thumbnail( $post->ID ) ){
    								$attribute = array(
    									'alt' => get_the_title(),
    									'title' => get_the_title(),
    									//'class' => 'status-'.$status_id,
    								);
    								echo get_the_post_thumbnail( $post->ID, 'real-property-loop', $attribute );
    							}else{
    								echo '<img src=&quot;https://www.placehold.it/270x180/&quot; />';
    							}
    							echo '</a>';
    						?>
    								<div class=&quot;property-status status-<?php echo $status_id; ?>-text&quot;><?php echo $property_status; ?></div>
    							</div><!-- /.property-images -->
    							<div class=&quot;property-attribute&quot;>
    								<?php if ( of_get_option( 'hide_love' ) ): ?>
                                        <h3 class=&quot;attribute-title text-center&quot;><a>&quot; title=&quot;<?php echo get_the_title(); ?>&quot; ><?php echo substr( get_the_title(), 0, 27); if( strlen( get_the_title() ) > 27 ) { echo'...'; } ?></a></h3>
                                </h3>
                                    <?php else: ?>
                                        <h3 class=&quot;attribute-title&quot;><a>&quot; title=&quot;<?php echo get_the_title(); ?>&quot; ><?php echo substr( get_the_title(), 0, 27); if( strlen( get_the_title() ) > 27 ) { echo'...'; } ?></a><i class=&quot;icon-heart&quot;></i></h3>
                                    <?php endif; ?>
    								<span class=&quot;attribute-city&quot;>
    								<?php
    								$city_terms = get_the_terms( $post->ID,&quot;property-city&quot; );
    								if(!empty( $city_terms )){
    									foreach( $city_terms as $city_term ){
    										echo $city_term->name;
    									}
    								}
    								?>
    								</span>
    								<div class=&quot;attribute-price&quot;>
    									<span class=&quot;attr-pricing&quot;>
    										<?php property_price(true, true); ?>
    									</span>
    								</div>
    							</div>
    							<div class=&quot;property-meta clearfix&quot;>
    							<?php
    								$meta_size = get_post_meta( $post->ID, 'REAL_EXPERT_property_size', true );
    								$meta_bedrooms = get_post_meta( $post->ID, 'REAL_EXPERT_property_bedrooms', true );
    								$meta_bathrooms = get_post_meta( $post->ID, 'REAL_EXPERT_property_bathrooms', true );
    							?>
    								<div class=&quot;meta-size meta-block&quot;><i class=&quot;ico-size&quot;></i><span class=&quot;meta-text&quot;><?php echo $meta_size; ?></span></div>
    								<div class=&quot;meta-bedroom meta-block&quot;><i class=&quot;ico-bedroom&quot;></i><span class=&quot;meta-text&quot;><?php echo $meta_bedrooms; ?></span></div>
    								<div class=&quot;meta-bathroom meta-block&quot;><i class=&quot;ico-bathroom&quot;></i><span class=&quot;meta-text&quot;><?php echo $meta_bathrooms; ?></span></div>
    								<?php 
    									$pool = get_post_meta( $post->ID, 'REAL_EXPERT_property_pool', true );
    									if ( $pool == 'yes' ) {
    										?><div class=&quot;meta-pool meta-block&quot;><i class=&quot;ico-pool&quot;></i></div><?php 
    									}
    								?>
    							</div>
    						</article>
    					</div>
    					<?php
    				endwhile;
    				wp_reset_query();
    			endif;
    		?>
    				</div><!-- jcontainer -->
    			</div><!-- /.jcarousel -->
    		</div><!-- /.container --> 
    • This topic was modified 6 years, 3 months ago by paulie77.

    The page I need help with: [log in to see the link]

  • The topic ‘Jcarousel showing all posts’ is closed to new replies.