Created
August 9, 2017 05:48
-
-
Save hasibdesk/6fd301cc17568421e3a0e84006c2b1a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: ThemeMetal Toolkit | |
Plugin URI: http://thememetal.com/ | |
Description: This plugin only used for ThemeMetal Compnay theme. | |
Author: Md Hasibul Hossain | |
Version: 1.0 | |
Author URI: http://thememetal.com/ | |
*/ | |
function google_map($atts, $content = null){ | |
$a = 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!1d14601.584217945043!2d90.360714!3d23.80451155!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sbd!4v1502255870576" width="600" height="450" frameborder="0" style="border:0" allowfullscreen></iframe>'; | |
}else{ | |
$map = '<h1>You have to login to view map!</h1>'; | |
} | |
if(!empty($a['title']) && is_user_logged_in()){ | |
$map.= '<h1>'.$a['title'].'</h1>'; | |
}else{ | |
$map.= ''; | |
} | |
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