WordPress.org

Ready to get started?Download WordPress

Forums

Pronamic Google Maps
[resolved] Put post title & location in bubble description? (4 posts)

  1. debsch
    Member
    Posted 1 year ago #

    I'd like to minimise the amount that users have to put into the form to get their map. Is there a way to have to have the post title and/or the map's address automatically put into the map marker's bubble description? Rather than having to put in a description manually?

    I tried fiddling with the code and changed:

    $description = wp_kses_post($description);
    to
    $description = wp_kses_post($address);

    ... but as far as I can see it hasn't changed anything.

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

  2. Remco Tolsma
    Member
    Plugin Author

    Posted 1 year ago #

    You should never adjust directly plugin files:
    https://github.com/pronamic/wp-pronamic-google-maps/blob/2.2.3/classes/Pronamic_Google_Maps_Admin.php#L202

    You could use the following example to adjust the description in the single map bubble:
    https://github.com/pronamic/wp-pronamic-google-maps/blob/master/examples/map-filter-description.php

  3. debsch
    Member
    Posted 1 year ago #

    Works beautifully THANKS!

    ... and to add the post title i've added get_the_title() to your code...

    /**
    * Filter snippet
    */
    function prefix_pronamic_google_maps_item_description( $description ) {
    global $post;
    
    $description = get_the_title().'<BR>'.get_post_meta( $post->ID, '_pronamic_google_maps_address', true );
    
    return $description;
    }
  4. Tusko Trush
    Member
    Posted 1 year ago #

    I was used it :)

    function prefix_pgmm_item($itemContent) {
    	$itemContent = '';
    	$itemContent .= '<h2>';
    	$itemContent .= '	<a href="'. get_permalink() .'">';
    	$itemContent .= '		'. get_the_title();
    	$itemContent .= '	</a>';
    	$itemContent .= '</h2>';
    	$itemContent .= '<h3>Address</h3>';
    	$itemContent .= wpautop(get_post_meta(get_the_ID(), '_pronamic_google_maps_address', true));
    	$itemContent .= '<h3>Description</h3>';
    	$itemContent .= wpautop(get_post_meta(get_the_ID(), '_pronamic_google_maps_description', true));
    
    	return $itemContent;
    }
    
    add_filter('pronamic_google_maps_mashup_item', 'prefix_pgmm_item');

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.