Order of listing results

This topic contains 7 replies, has 2 voices, and was last updated by  Simone 8 years, 12 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #42326

    explorer
    Expired Member
    Post count: 172

    Hi, currently order of listing results looks like its displaying by date of creation. Can we change this to alphabetical by default?

    Thanks.

    #42346

    Simone
    Expired Member
    Post count: 3515

    Hi, are you talking about the Popular post view widget? In that case, there is a sorting by AZ.
    You can also play in the post type settings, in the Sorting option, you can add Title and made it the default sorting (asc/desc)

    #42834

    explorer
    Expired Member
    Post count: 172

    Hi Simone,

    Im just talking about regular listings in the category listings pages. Eg. view all hotels, or all places, etc.

    Your second suggestion there would work except that then it over rides the Featured listings being listed first, which is of course important.

    Is there a way to do this on a global scale so it effects all CPT’s at once?

    Thanks, Bodhi

    #42846

    Simone
    Expired Member
    Post count: 3515

    Hi, so in the Listing page.. Some time ago I wrote a code to add a content section in that page so you can drag a widget, in your case a widget for the featured listings, and below you will have the other listings sorted by A-Z, will it work? Following you’ll find the code, add it in the functions.php file inside your child theme’s folder and then you will find a new widget area GD Listing Content Section

    
    
    function listing_content_init() {
    
    	register_sidebar( array(
    		'name' => 'GD Listing Content Section ',
    		'id' => 'listing_content',
    		'before_widget' => '<div>',
    		'after_widget' => '</div>',
    		'before_title' => '<h2">',
    		'after_title' => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'listing_content_init' );
    
    			 
    			
    			add_action( 'geodir_main_content_open', 'geodir_listings_map_before', 10 );
    				function geodir_listings_map_before() { ?>
    							<?php if ( is_active_sidebar( 'listing_content' ) ) : ?>
    								<div>
    									<?php dynamic_sidebar( 'listing_content' ); ?>
    								</div>
    			
    #43111

    explorer
    Expired Member
    Post count: 172

    Hi Simone, i think that will likely work for us but i keep getting a syntax error when i put that into the site.

    I copied and pasted exactly what you have there. Its saying unepexted } or unexpected ending depending where i place your code.

    Thank you, almost there.

    #43114

    Simone
    Expired Member
    Post count: 3515

    Sorry, I copied it impartially, there you go

    
    
    function listing_content_init() {
    
    	register_sidebar( array(
    		'name' => 'GD Listing Content Section ',
    		'id' => 'listing_content',
    		'before_widget' => '<div>',
    		'after_widget' => '</div>',
    		'before_title' => '<h2">',
    		'after_title' => '</h2>',
    	) );
    }
    add_action( 'widgets_init', 'listing_content_init' );
    
    			 
    			
    			add_action( 'geodir_main_content_open', 'geodir_listings_map_before', 10 );
    				function geodir_listings_map_before() { ?>
    							<?php if ( is_active_sidebar( 'listing_content' ) ) : ?>
    								<div>
    									<?php dynamic_sidebar( 'listing_content' ); ?>
    								</div>
    								<?php endif;  	} 
    #43123

    explorer
    Expired Member
    Post count: 172

    Hi thanks, the updated code worked. However, i cant find a widget that allows me to show the current cpt featured posts. They all seem to make you choose a CPT. because this will be effecting multiple cpt’s it would need to be relevant to the CPT currently in view.

    Is this possible?

    B

    #43125

    Simone
    Expired Member
    Post count: 3515

    Hmmm….I think this is not possible

Viewing 8 posts - 1 through 8 (of 8 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket