Skip to content

Instantly share code, notes, and snippets.

@rubel306
Created May 16, 2018 07:16
Show Gist options
  • Save rubel306/9261c9d725559e20b1684cf6d220164b to your computer and use it in GitHub Desktop.
Save rubel306/9261c9d725559e20b1684cf6d220164b to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Industry Toolkit
Plugin URI: http://www.bandevs.com
Author: Rubel Hasan
Author URI: http://www.facebook.com/rubel.hasan.3572
Description: This plugin use for only this theme
Version: 1.0
Tag: Industry, Basic, Shortcode generator
*/
function google_map($atts, $content = null){
$value = shortcode_atts(array(
'width' => 600,
'height' => 450,
'title' => ''
), $atts);
if(is_user_logged_in()) {
$map = '<iframe src="https://www.google.com/maps/embed?pb=!1m10!1m8!1m3!1d14577.424680201519!2d90.41723125000001!3d24.0185022!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sbd!4v1526452491132" width="'.$value['width'].'" height="'.$value['height'].'" frameborder="0" allowfullscreen></iframe>';
}else{
echo "<h1>Please you need to login to view this content</h1>";
}
if(!empty($value['title']) && is_user_logged_in() ){
$map .= ''.$value['title'].'';
}else{
echo 'You need to register';
}
return $map;
}
add_shortcode('gmap','google_map');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment