Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Elendil57

    (@elendil57)

    Here’s my code :

    I would like that the Mashup works only for posts in $catencours2

    <?php
    $cat = get_query_var('cat');
    global $catencours;
    $catencours = get_category ($cat);
    global $catencours2;
    $catencours2 = $catencours->cat_ID;
    $posts_array = get_posts( $args );
    $args = array(
        'category'        => $catencours2,
        'post_type'       => 'post',
        'suppress_filters' => true );
     echo  'Current cat is : num '.$catencours2;
    if ( is_category ($catencours2)) {
        pronamic_google_maps_mashup(
            array(
                'post' => $posts_array,
    			'posts_per_page' => -1,
    			 ) ,
            array(
                'width' => 295 ,
                'height' => 370 ,
                'map_type_id' => 'roadmap',
                'marker_options' => array(
                    'icon' => 'https://www.metz-hardware.com/dehors-les-enfants/wp-content/uploads/2013/02/marker-gmap.png'
                )
            )
        );
    } else {
    	theme_print_sidebar('default', $places); }

    Thanks,

    Elendil57

    Thread Starter Elendil57

    (@elendil57)

    Yes ! I’ve made it !

    I re-give the fonctionnality of this code :
    displaying in Mashup map markers which only correspond to posts displayed on the current page.
    Handsome for posts in subcategory!

    Maybe it should be optimized, for sure ??

    Here the code :

    $cat = get_query_var('cat');
    global $catencours;
    $catencours = get_category ($cat);
    global $catencours2;
    $catencours2 = $catencours->cat_ID;
    // for verifying the value of $catencours2, should be delete when it works :
    echo  'Current cat is : num '.$catencours2.'<br/><br/>';
         pronamic_google_maps_mashup(
            array(
                'category__in' => array( $catencours2 ),
    			'posts_per_page' => -1,
    			 ) ,
            array(
                'width' => 295 ,
                'height' => 370 ,
                'map_type_id' => 'roadmap',
                'marker_options' => array(
                    'icon' => 'YOUR_ICON.png'
                )
            )
        );

    Hope it’ll help other people,

    Elendil57

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Filtering displayed posts in Mashup map’ is closed to new replies.