Last active
December 5, 2018 07:04
-
-
Save oliwa/b9e7da9c2406c98a795d29a5e4bd96b8 to your computer and use it in GitHub Desktop.
Wordpress Shortcode with multiple Variables
This file contains 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 | |
function ppai_quotebox( $atts ) { | |
$templateDirectory = get_bloginfo('template_directory'); | |
extract( shortcode_atts( array( | |
'imgpath' => $templateDirectory.'/images/quote-dummy.jpg', | |
'quote' => 'Ohne ein Zitat sehe ich scheisse aus', | |
'author' => 'Die Zitatbox', | |
), $atts ) ); | |
$render_quotebox = | |
'<section class="project-quote group">'. | |
'<figure><img src="'.$imgpath.'" alt="'.$author.'" /></figure>'. | |
'<div class="project-quote-quote">'. | |
'<blockquote>»'.$quote.'«</blockquote>'. | |
'<p>'.$author.'</p>'. | |
'</div>'. | |
'</section>'; | |
return $render_quotebox; | |
} | |
add_shortcode( 'quotebox', 'ppai_quotebox' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment