Expired Custom Post Types Listings

This topic contains 22 replies, has 4 voices, and was last updated by  Stiofan O’Connor 7 years, 10 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #393244

    Andrea Piaggesi
    Expired Member
    Post count: 42

    Hi,
    sorry for this reply but is there any chance for this request?
    Thank you very much.

    Andrea

    #393245

    Paolo
    Site Admin
    Post count: 31211

    Being a customization, we give priority to support requests. As soon as a developer will be available to answer they will.

    Thanks

    #393246

    Andrea Piaggesi
    Expired Member
    Post count: 42

    Ok ok, thank you very much.
    I’m glad you’re consider this request.

    Thanks!
    Andrea

    #393250

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Andrea,

    Yes this is defiantly a customisation but i’ll give you an example code snippet.
    You will have to filter the WHERE part of the query, if you provide wp-admin i will apply an example snippet to your site. Also if you can explain exactly where this should happen, just on the category list pages i guess?

    Thanks,

    Stiofan

    #393251

    Andrea Piaggesi
    Expired Member
    Post count: 42
    This reply has been marked as private.
    #393327

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Andrea,

    I added the following code as a code snippet to your site.

    Your urls should work like:
    dev.YOURSITE.net/social/proposals/
    dev.YOURSITE.net/social/proposals/?archive=true

    
    
    function _my_gd_listing_where_filter($where){
    	global $table;
    	$geodir_post_type = geodir_get_current_posttype();
    
    	if($geodir_post_type=='gd_idea' || $geodir_post_type=='gd_project'){
    		$date_now = date("Y-m-d");
    		$date_param = isset($_REQUEST['archive']) ? '<=' : '>';
    		if (!is_admin()) {
    			$where .= " AND $table.geodir_end_proposal_date $date_param '$date_now' ";
    		}
    	}
    
    	return $where;
    }
    
    function _my_gd_listing_where(){
    
    	if (!is_admin()) {
    		if (geodir_is_page('listing')){
    		add_filter('posts_where', '_my_gd_listing_where_filter', 10,1);
    		}
    	}
    }
    
    add_action('pre_get_posts', '_my_listing_loop_filter', 2);
    function _my_listing_loop_filter($query){
    
    	// fix wp_reset_query for popular post view widget
    	if (!geodir_is_geodir_page()) {
    		return;
    	}
    
    	if (isset($query->query_vars['is_geodir_loop']) && $query->query_vars['is_geodir_loop']) {
    		_my_gd_listing_where();
    	}
    
    	return $query;
    }

    Thanks,

    Stiofan

    #393502

    Andrea Piaggesi
    Expired Member
    Post count: 42

    Stiofan,
    it worked flawlessly.

    THANK YOU VERY MUCH for this great support.
    The custom sorting also works without any changes in the archive section because the url keep the archive=true parameter.

    Many thanks for this!!
    Andrea

    #393506

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    You are welcome Andrea 🙂

    Feel free to leave us a review if you have not already, it helps us grow! 🙂
    https://wordpress.org/support/plugin/geodirectory/reviews/?rate=5#new-post

    Thanks,

    Stiofan

Viewing 8 posts - 16 through 23 (of 23 total)

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount