wordpress-geo-mashup icon indicating copy to clipboard operation
wordpress-geo-mashup copied to clipboard

Restrict map by meta values

Open ReasonableGeek opened this issue 9 years ago • 3 comments

Hi,

I'm looking a way to restrict my post by metavalues

I was trying pre_get_posts without success ....

Someting like that would be great :

$args_map = array( 'map_post_type' => 'mycpt', 'meta_query' => array( array( 'key' => '_rdv_cons_id', 'value' => $cons_id, 'compare' => '=' ) ) );

echo GeoMashup::map($args_map);

or Someone know how to achieve that ?

Thanks

ReasonableGeek avatar Mar 05 '16 20:03 ReasonableGeek

I tried https://wordpress.org/support/topic/filter-by-meta_key?replies=5 in my template page.

<?php query_posts( 'tag=example' ); ?>
<?php echo GeoMashup::map( 'map_content=contextual' ); ?>
<?php wp_reset_query(); ?>

Without success...

ReasonableGeek avatar Mar 05 '16 21:03 ReasonableGeek

GOT IT !

I wrote 'key' and not 'meta_key'.......

Here if it can help :

query_posts( array ('post_type' => 'da_cpt',
                    'meta_query'     => array(
                        array(
                            'meta_key' => '_rdv_cons_id',
                            'value' => 7, // make it dynamic
                            'compare' => '=',
                    'type' => 'NUMERIC'
                        )
                     )
                    )
                    );

echo GeoMashup::map( 'map_content=contextual' );
wp_reset_query(); 

ReasonableGeek avatar Mar 05 '16 21:03 ReasonableGeek

In fact no, it seems not working...

ReasonableGeek avatar Mar 11 '16 09:03 ReasonableGeek