Skip to:
Content
Pages
Categories
Search
Top
Bottom

Current “Place” Map In Sidebar (Yelp-type Layout)

  • Avatar of johnnyrokkit
    johnnyrokkit
    Member

    @johnnyrokkit

    Hello! Is there a way to get the map of the currently active “Place” to appear in the sidebar, rather than in the body of the post? Yelp does this with their listings, and it’s a layout we’d love to be able to emulate. Here’s a screen capture for reference: http://screencast.com/t/pCMVjgQnXz

    Thanks very much, and apologies if I’ve missed something obvious. I’ve had a look around and I don’t think I’ve seen anything related.

    Cheers,
    John

Viewing 3 replies - 1 through 3 (of 3 total)
  • @johnnyrokkit – It is indeed possible by using the available hooks, filters and functions, and have done so myself on a demo project, as seen here – http://smalley.my/spiagge/place/ipoh/

    This is done by first filtering out the content with something such as (in theme functions.php or gpress/custom.php):
    `
    /* THIS EXAMPLE SIMPLY REMOVES THE MAP FROM SINGLE PLACE PAGES */
    function spiagge_remove_map_from_place_content($content, $id){
    if(is_single()){
    return get_the_content($id);
    }else{
    return $content;
    }
    }
    add_filter(‘gpress_content’,’spiagge_remove_map_from_place_content’, 1, 2);
    `

    And then, in your sidebar, you could add something such as:
    `
    global $post;
    $post_type = get_post_type( $post );
    $title = $post->post_title;
    $id = $post->ID;
    if((is_single()) && ($post_type == ‘place’)) {
    $map_settings = array(
    ‘map_id’ => ‘_gpress_places’,
    ‘map_height’ => ‘300’,
    ‘map_type’ => ‘ROADMAP’,
    ‘map_zoom’ => ’13’,
    ‘post_type’ => ‘widget’,
    ‘post_id’ => false,
    ‘place_id’ => $id,
    ‘marker_title’ => ‘_gpress_widgets_places’,
    ‘marker_url’ => false
    );
    gpress_add_map($map_settings);
    }
    `

    These and other functions will be made much easier and FAR more flexible in the next release, but its amazing just how much can be done already with the existing hooks and filters…

    Avatar of johnnyrokkit
    johnnyrokkit
    Member

    @johnnyrokkit

    Many sincere thanks for the thorough explanation! I was thrilled to find this plugin and I hope to be able to share a site worthy of the gPress Gallery in a couple of months.

    Cheers!
    John

    EDIT: Mark, worked like a charm! Thanks again!

    Glad it worked-out nicely for you and that you are having fun experimenting with the possibilities… Look forward to hearing back from you with those cool examples so that I can add them to the gallery / showcase… :-)

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.