Home Passing parameters to Wordpress Infinite Scroll With Custom Theme
Reply: 0

Passing parameters to Wordpress Infinite Scroll With Custom Theme

Pedro Gusmão
1#
Pedro Gusmão Published in 2017-12-07 20:36:54Z

i've developed this page and recently i managed do add pagination to my wordpress custom theme. I've implemented a simple "next" button, that send me to another page with different posts. The problem is: Every plugin/script i download requires four atributes: Posts selector, Post selector, Navigation Selector and Next Selector.

I could use any infinite scroll plugin, but to exemplify this, i'll show the latest i've downloaded, called "Ajax Pagination". I know there is a lot of tutorials like this one, but i really didn't managed do get it running, so i'm asking for your help.

Here is the code i use to loop through the pages and paginate:

<div class="container" id="container">
			
<div class="portfolio-items2">


<article class="post">

				<?php
				
				
				$variavel1 = get_query_var ('paged');
				
$newsArgs = array( 'post_type' => 'property',
																			
																			'posts_per_page' => 24 ,
																			'paged' => $variavel1 ,
																			 "orderby" => 'meta_value_num',
																					"meta_key" => 'numerooff',
																					"order" => 'DESC',
																							
																			'tax_query' => array(
																					array(
																							'taxonomy' => 'property-status',
																							'field'    => 'slug',
																							'terms'    => 'oneoff',
																					))	 
																			
															);                   
$newsLoop = new WP_Query( $newsArgs );                  
while ( $newsLoop->have_posts() ) : $newsLoop->the_post();

?>










<div id="post-unico" class="col-md-4 shortcode-col listing_wrapper <?php meta('seletoroff');?>" > 
    <div class="property_listing" data-link="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>">
        <div class="listing-unit-img-wrapper"><div class="property_media">  </div>
		<a href="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>">
		<img width="525" height="350" src="<?php meta('imagemoff');?>" class="lazyload img-responsive wp-post-image" alt=""  sizes="(max-width: 525px) 100vw, 525px" /></a>
				<div class="tag-wrapper"><div class="featured_div"><?php meta('porcentooff');?></div></div></div>
				<h4><a href="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>">
                <?php meta('titulooff');?> </a> </h4> 
            
            <div class="property_location_image"><a href="http://www.onecia.com.br/imoveis-de-luxo/<?php /* Property ID if exists */ $property_id = get_post_meta($post->ID, 'REAL_HOMES_property_id', true); if(!empty($property_id)){ echo ''.$property_id; }?>" rel="tag">
			<span style="font-size: 15px;"><?php meta('bairrooff');?> </span></a></div>   <br>     
           
		   
		   
		   
		   <div class="property_listing_details">
		   
		   <?php
        $post_meta_data = get_post_custom($post->ID);

        if( !empty($post_meta_data['REAL_HOMES_property_size'][0]) ) {
                $prop_size = $post_meta_data['REAL_HOMES_property_size'][0];
                
                
                 echo '<div class="inforoom">'. $prop_size .'m² <div class="info_labels"><img src="http://www.onecia.com.br/wp-content/themes/site2016/images/icon-size.png" style="max-width: 14%; height: auto;"></div></div>';
                
             
        }

        if( !empty($post_meta_data['REAL_HOMES_property_bedrooms'][0]) ) {
                $prop_bedrooms = floatval($post_meta_data['REAL_HOMES_property_bedrooms'][0]);
                $bedrooms_label = ($prop_bedrooms > 1)? __('Bedrooms','framework' ): __('Bedroom','framework');
				
                echo '<div class="infobath">'. $prop_bedrooms .'<div class="info_labels"><img src="http://www.onecia.com.br/wp-content/themes/site2016/images/icon-bed.png" style="max-width: 17%; height: auto;"></div></div>';
				
        }

        if( !empty($post_meta_data['REAL_HOMES_property_bathrooms'][0]) ) {
                $prop_bathrooms = floatval($post_meta_data['REAL_HOMES_property_bathrooms'][0]);
                $bathrooms_label = ($prop_bathrooms > 1)?__('Bathrooms','framework' ): __('Bathroom','framework');
                echo '<div class="infosize">'. $prop_bathrooms .'<div class="info_labels"><img src="http://www.onecia.com.br/wp-content/themes/site2016/images/icon-bath.png" style="max-width: 17%; height: auto;">
				 </div></div>';
        }

     

  ?>

  
  
  </div>
		   
				  <div class="listing_unit_price_wrapper">
				  <span class="price_label price_label_before" style="text-decoration: line-through;">De: R$ <?php meta('valordeoff');?></span><br> 
				  <span style="text-decoration: underline; font-size: 22px; font-weight: bold;">Por: R$ <?php meta('valoroff');?> </span>
				  <span class="price_label"></span></div>  
		</div>             
	</div> 




<?php  endwhile; ?>
</article>
</div>  </div>

The problem is that i haven't configured any navigation bar, i've just made a "next" reference, like you can see:

<?php  next_posts_link('<center><nav class="navigation pagination">Veja mais imóveis</nav></center>', $newsLoop->max_num_pages);  ?>

Here is how i'm filling the info's on this plugin. Could you please help me, and see what i'm doing wrong? Or i need to set up a Twenty-X themed navigation bar, or i filled something wrong, or both! I really need help here. Waiting, thanks!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307545 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO