I'm hacking up some code which returns a googlemap when a specific tag is inserted into the post. Of course the problem is that kses strips the script tags out of the content.
I don't want to open up script tags for obvious reasons so I was wondering how easy it would be to put some code in so that I can use say <stevescripttag> </stevescripttag> in my plugin and then right before the final rendering do a str_replace to change my obscure tag into the proper script tag.
Does that make sense?
Edited - to add:
Its the category feed - it chops the post up and messes with the text. So I guess I need to supress my output if its going to the category view
lunabyte
Member
Posted 17 years ago #
You could add a filter, yes.
Make it insert a tag like [tag], then do a str_replace on the content/excerpt.
From there, if you only want the map on a full post, if is_single == true, show map (string replace with proper calls), else string replace the tag with a blank.
Well I've got it working - its rather hard to explain but basically I'm extending WPMU to allow people to blog about trips on the UK Canal system. So I've got some extra tables containing "trips" and place/co-ordinate data.
When a post containing the tag is parsed the code works out if the post is part of a blogged trip and if it is inserts a map showing the appropriate part of the trip (i.e. the part travelled that day)
http://canalplan.blogdns.com/mintball/blogged-routes.php?routeid=2
Now all I've got to do is stop it appearing in RSS feeds!
Not sure if you are still looking for tips with Google Maps and Wordpress MU, but if so, the following geoRSS article might be of help, as this explains how to add code to your function file in order to make your blog geoRSS compatible:
http://wpmupremium.com/news/2009/02/05/adding-georss-functionality/
As for all-out full-screen fun, please check-out gMaps:
http://wpmupremium.com/blog/2009/02/17/introducing-wpmu-gmaps/