• I have a classifieds site, I would like to know if there is the possibility of makes customers’ profiles rotate, and does not always leave them in the same position in the site home, with a plugin or css code.
    For example, the customer who created an ad a week ago always remains in last position compared to those who created an ad today. There is the possibility of making their profiles move for the homepage giving everyone the opportunity to have their ad at the top.
    Thanks in advance to those who will help me

    • This topic was modified 5 years, 10 months ago by Jan Dembowski.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Not nearly enough information but odds are, in what ever file is being used for your home page or possibly your theme’s functions.php there’s a query. That query uses variables for the order and orderby : https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters and most likely it contains something like:

    'order' => 'DESC',
    'orderby' => 'date'
    ...

    and a simple way to accomplish what your asking is to change the orderby to rand

    Thread Starter adr10

    (@adr10)

    I tried to put only that nothing changes, could you see if it is correct?

    
    <!-- NORMAL PROFILES start -->
    	    	<div class="bodybox bodybox-homepage">
    	        	<h3 class="l"><?php printf(esc_html__('Newly Added %s','wp'),ucwords($taxonomy_profile_name_plural)); ?></h3>
    	        
    	        	<div class="clear"></div>
    				<?php
    				$args = array(
    					'post_type' => $taxonomy_profile_url,
    					'meta_query' => array( array('key' => 'premium', 'value' => '0', 'compare' => '=', 'type' => 'NUMERIC') ),
    					'posts_per_page' => get_option("frontpageshownormalcols") * 5
    'orderby' => 'rand',
    				);
    				$normal_profiles = new WP_Query( $args );
    				$i = "1";
    				if ($normal_profiles->have_posts()) :
    					while ( $normal_profiles->have_posts() ) : $normal_profiles->the_post();
    						include (get_template_directory() . '/loop-show-profile.php');
    					endwhile;
    				else:
    					printf(esc_html__('No %s here yet','wp'),$taxonomy_profile_name_plural);
    				endif;
    				wp_reset_postdata();
    				?>
    	            <div class="clear"></div>
    	        <
    			<!-- NORMAL PROFILES end -->
    			<?php } // if $frontpageshownormal = 1 ?>
    
    			<?php if (get_option("frontpageshowrev") == 1) { ?>
    			<?php
    			$args = array(
    				'post_type' => 'review',
    				'posts_per_page' => get_option("frontpageshowrevitems"),
    				'orderby' => 'rand',
    			);
    			$reviews_query = new WP_Query( $args );
    			if ( $reviews_query->have_posts() ) : 
    			?>
    
    • This reply was modified 5 years, 11 months ago by Yui. Reason: please use CODE button for proper formatting

    Hard to tell right off but you seem to be missing a comma at the end of:
    'posts_per_page' => get_option("frontpageshownormalcols") * 5
    Are you getting any errors at all because of that?

    Are you using a free them by chance?

    • This reply was modified 6 years, 1 month ago by tugbucket.
    Thread Starter adr10

    (@adr10)

    I tried adding the comma but nothing happened. I’m not having any problems, I bought the theme, it’s not from chance

    Do you have a link to your page in question. The query looks fine but might be something else.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘plugin or string to make ads move’ is closed to new replies.