Created
July 28, 2018 11:51
-
-
Save hasinhayder/d5bdcd3c545d71a7ff3e2ba0138ff8da to your computer and use it in GitHub Desktop.
Revisions
-
hasinhayder created this gist
Jul 28, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ <?php function philosophy_button( $attributes ) { $default = array( 'type'=>'primary', 'title'=>__("Button",'philosophy'), 'url'=>'', ); $button_attributes = shortcode_atts($default,$attributes); return sprintf( '<a target="_blank" class="btn btn--%s full-width" href="%s">%s</a>', $button_attributes['type'], $button_attributes['url'], $button_attributes['title'] ); } add_shortcode( 'button', 'philosophy_button' ); function philosophy_button2( $attributes, $content='' ) { $default = array( 'type'=>'primary', 'title'=>__("Button",'philosophy'), 'url'=>'', ); $button_attributes = shortcode_atts($default,$attributes); return sprintf( '<a target="_blank" class="btn btn--%s full-width" href="%s">%s</a>', $button_attributes['type'], $button_attributes['url'], do_shortcode($content) ); } add_shortcode( 'button2', 'philosophy_button2' ); function philosophy_uppercase($attributes, $content=''){ return strtoupper(do_shortcode($content)); } add_shortcode('uc','philosophy_uppercase'); function philosophy_google_map($attributes){ $default = array( 'place'=>'Dhaka Museum', 'width'=>'800', 'height'=>'500', 'zoom'=>'14' ); $params = shortcode_atts($default,$attributes); $map = <<<EOD <div> <div> <iframe width="{$params['width']}" height="{$params['height']}" src="https://maps.google.com/maps?q={$params['place']}&t=&z={$params['zoom']}&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"> </iframe> </div> </div> EOD; return $map; } add_shortcode('gmap','philosophy_google_map');