Skip to content

Instantly share code, notes, and snippets.

@jo-flynn
Last active September 9, 2016 15:42
Show Gist options
  • Save jo-flynn/1a2acede780cffd99a1aa8e46de848e6 to your computer and use it in GitHub Desktop.
Save jo-flynn/1a2acede780cffd99a1aa8e46de848e6 to your computer and use it in GitHub Desktop.
<?php
if (!empty($title)) {
?>
<h4>
<?php
echo $title;
?>
</h4>
<?php
}
if (!empty($text)) {
?>
<div class="callout-text">
<?php
echo $text;
?>
</div>
<?php
}
<?php
// usage: [fancy-callout heading="Custom Heading"]Custom Content[/fancy-callout]
add_shortcode('fancy-callout', function ($atts, $content = null) {
return silencio_partial('fancy-callout', ['heading' => $atts['heading'], 'text' => $content], false);
});
<?php
// .. other single.php logic
silencio_partial('fancy-callout', ['heading' => $post->post_title, 'text' => $post->post_excerpt]);
// .. other single.php logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment