
David Hollander of SparkWeb Interactive sent us in a little code clip for inserting Google Maps into Posts/Pages by the use of shortcodes. Google actually has copy-and-pastable iframe code already in Google Maps that is really easy to snag, but David was having problems with the Visual text editor screwing up the code when saving the Post. With a short code, no problem.
Put in functions.php file
//Google Maps Shortcode
function fn_googleMaps($atts, $content = null) {
extract(shortcode_atts(array(
“width” => ‘640′,
“height” => ‘480′,
“src” => ”
), $atts));
return ‘<iframe width=”‘.$width.’” height=”‘.$height.’” frameborder=”0″ scrolling=”no” marginheight=”0″ marginwidth=”0″ src=”‘.$src.’”></iframe>’;
}
add_shortcode(“googlemap”, “fn_googleMaps”);
Usage inside Post/Page:
[googlemap width="200" height="200" src="[url]“]
Notice the three parameters above. Width and height are self explanitory, don’t use them at all for the default values set in the function itself. The src URL you can snag from Google Maps like this:
Easy!
This post is a good reminder…
2378 readersFacebook is getting more and more popular everywhere on the net. Thanks to the Like button and other Facebook plugins, we can now interact and share content directly from all kinds of websites to Facebook. But what about embedding videos from Facebook to your website? We have discussed about the integration of the Open Graph
2958 readersRecently, WPRecipes posted an incredibly useful technique that uses a shortcode to add private content to blog posts. This functionality makes it easy to manage leftover data, miscellaneous notes and other communication by keeping everything together with its corresponding post. Consolidating information like this helps to streamline flow and organization into the future. Combine the power
1052 readersSince some days several contacts have been considering the option to display upcoming posts on their site. WordPress offers a really simple solution for this in the form of the attribute post_status. The post_status is stored in the wp_post table and has generally the attributes: draft, private, publish or static for pages. There is one
2572 readersOne thing that WordPress doesn’t have the ability to do “out-of-the-box” is do includes, in the sense of including the content of one post into the content of another post directly in the post editor. For the umpteenth time around here, shortcodes to the rescue! This issue came up while my co-worker Tim at Wufoo
1824 readersWe covered how to run a shortcode in a widget. But what about inserting a widget with a shortcode? I recently had this situation come up. I had a single page where I just wanted to be able to chuck in a widget without the whole rigmarole of creating a special widgetized area and probably
1054 readersTwitter has become a very useful tool for all bloggers, and allows us to share and promote useful articles to fellow bloggers. Naturally, we have seen more and more twitter functions integrated into our blogs; the latest Official twitter button has even made it easier to integrate twitter buttons on your blog. But what if
2535 readersIncludes are a very handy functionnality of the PHP language. Unfortunely, there's no built in solution to include posts in other posts in WordPress. Today's recipe is a shortcode that will allow you to finally do includes. Looking for WordPress hosting? Try WP Web Host. Prices starts at $5/month and you can try it for
2456 readersI had the occasion yesterday to have a page with a section on it where it would output a very specific set of other pages, which would need to change dynamically. What I could have done is built a special page template for this page, and inside that template run a query_posts() to get these
390 readersLast week I wrote how to “Use WordPress to print a RSS feed for Eventbrite attendees“. It was pretty popular, but then I found myself in a place that was more annoying. Trying to incorporate that into a blog post or page. Without having to download a plugin that will allow PHP to be executed inside
698 readersSocial networks are everywhere. I am sure you're on facebook. Well why not at a facebook share script to your site?
4,618
Curious what others are searching for? Below are the most popular search terms over the last 30 days.

