• I’m using blogpress on my iPad to post to my wordpress blog. It uses the GPS to find and posts the location to the blog in the form :

    <p class="blogpress_location">Location:<a href="http://maps.google.com/maps?q=Miami,United%20States%4016.327043%2C-81.166456&z=10">Miami,United States</a></p>

    I want to be able to show a Google Map in the blog instead and am using Google Maps v3 Shortcode, which needs the format :

    [map w="500" h="400" map id="map7" z="7" address="Miami Beach,United States" marker="yes"]

    Any idea of some code or plugin that I can use to do a find and replace with wildcards to turn the link into the map shortcode.

    Eg:
    find <p class="blogpress_location">Location:<a href="http://maps.google.com/maps?q=**wildcard**&z=10">
    replace with
    [map w="500" h="400" map id="map7" z="7" address="**wildcard**" marker="yes"]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter riprod

    (@riprod)

    thanks, that looks like what I need but it’s a little over my head. Could you be a little more specific. Where in WP would I use it, what file do I edit ? Is there already a plugin created that would use it ?

    you could add a filter to your theme functions file:

    (this is not tested)

    add_filter('the_content', 'my_filter');
    
    function my_filter( $content ) {
    
    str_replace( '<p class="blogpress_location">Location:<a href="http://maps.google.com/maps?q=', '[map w="500" h="400" map id="map7" z="7" address="', $content);
    
    str_replace( '&z=10">', '" marker="yes"]', $content );
    
    return $content;
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Find and replace with wildcards’ is closed to new replies.