Support » Plugin: Pronamic Google Maps » [Plugin: Pronamic Google Maps] Adapt results to query_post()

  • Resolved Mark Jansen

    (@mark-jansen)


    I am using this plugin on an archive page for projects. I have 2 possible views, a list view and a mapview.

    In settings, the number of blogposts is set at 5, but whatever I try, I can’t seem to override that number for the map.

    I want to display all the projects on the map, where I want a paginated list, in the list view.

    Both
    global $query_string; query_posts($query_string.'&post_type=project&posts_per_page=10');

    and

    if(function_exists('pronamic_google_maps_mashup')) {
                pronamic_google_maps_mashup(
                    array(
                        'post_type' => 'project',
                        'numberposts' => 10,
                    ) ,
                    array(
                        'width' => 480 ,
                        'height' => 480 ,
                        'map_type_id' => 'roadmap'
    
                    )
                );
            }

    appear to be non-working solutions.

    Anyone that can offer me a kick in the right direction?

    http://wordpress.org/extend/plugins/pronamic-google-maps/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Remco Tolsma

    (@remcotolsma)

    bq. I want to display all the projects on the map,

    The following should work:

    if ( function_exists( 'pronamic_google_maps_mashup' ) ) {
    	pronamic_google_maps_mashup(
    		array(
    			'post_type' => 'project' ,
    			'posts_per_page' => -1 ,
    		) ,
    		array(
    			'width' => 480 ,
    			'height' => 480 ,
    			'map_type_id' => 'roadmap'
    		)
    	);
    }

    I use ‘posts_per_page’ instead of the ‘numberposts’ parameter:
    http://codex.wordpress.org/Function_Reference/WP_Query#Pagination_Parameters

    You could ofcourse also use the ‘nopaging’ => false parameter.

    This indeed seems to work. Thanks Remco

    By the way Mark,…you should never use ‘query_posts’, use ‘WP_Query’ (for subloops) or the ‘pre_get_posts’-hook (to alter the main loop) instead.

    Yeah, I know. I was building on to something that already existed, but I should change that, I know.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Pronamic Google Maps] Adapt results to query_post()’ is closed to new replies.