WordPress.org

Ready to get started?Download WordPress

Forums

Pronamic Google Maps
[resolved] SEARCH PRONAMIC MASHUP (3 posts)

  1. taz_bambu
    Member
    Posted 1 year ago #

    Hello and many thanks for the wonderful plugin.

    I have created a front end form to allow users submit a custom post type.

    Now, I have created a page to show the mashup.

    I am trying to allow users , apart from just having a look to the mashup,
    to be able to search through it bu the use of an input field for the area / location (i have custom fields for city and country etc. apart from pronamic address meta).

    So far I have built this:

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <form action="" method="post" name="searchgroup" id="searchgroup"><fieldset>
    <legend>Search for Groups in your Area!</legend>
    	<input type="text"  name="address" id="address"  placeholder="type your area" placeholder="Type your Area"/>
    	<input type="submit"  name="submit" id="submit" value="Go"/>
    
    <?php
    
    $input = $_POST['address'];
    $query1 = new WP_Query( array('post_type' => 'any' ));
    $query2 = new WP_Query( array('meta_value' => $input ));
    
    if (	get_post_meta( get_the_ID() ) == $input	)
    	{pronamic_google_maps_mashup($query2);
    	}
    else pronamic_google_maps_mashup($query1);
    
    ?>

    My query for the meta value does not work yet.

    Any ideas?
    Am I missing something? Is there any other way to do that?

    Thank you in advance!

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

  2. Remco Tolsma
    Member
    Plugin Author

    Posted 1 year ago #

    This goes a little beyond the support we can give on our free Google Maps plugin. But maybe you can figure it out with the following example:

    $args = array(
    	'meta_query' => array(
    		'relation' => 'OR',
    		array(
    			'key' => 'your_city_meta_key',
    			'value' =>  $input,
    			'compare' => 'LIKE'
    		),
    		array(
    			'key' => 'your_country_meta_key',
    			'value' =>  $input,
    			'compare' => 'LIKE'
    		),
    		array(
    			'key' => '_pronamic_google_maps_address',
    			'value' =>  $input,
    			'compare' => 'LIKE'
    		)
    	)
     );
    
    $query = new WP_Query( $args );

    See for more information also the WordPress documentation:
    http://codex.wordpress.org/Function_Reference/WP_Query#Custom_Field_Parameters

  3. taz_bambu
    Member
    Posted 1 year ago #

    Thanks very much for your prompt support.
    I am testing this in the mean time.

    Regards
    tasos

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic