Created
April 6, 2018 10:00
-
-
Save ScarletPonytail/2d7e4733637e9947a8b70983a75cf345 to your computer and use it in GitHub Desktop.
PHP - Bracket syntax inline if statement
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 if ( has_term( 'quote', 'sc_insighttype' ) ) { | |
$insightquote = get_post_meta( get_the_ID(), 'mbsc-insight-quote', true ); | |
?> | |
<div class="insight-box-quote"> | |
<?php if ( substr( $insightquote, 0, 1 ) === '"' || utf8_decode( substr( $insightquote, 0, 1 ) ) === utf8_decode( '“' ) ) { ?> | |
<?php echo '<h3>' . esc_html( $insightquote ) . '</h3>'; ?> | |
<?php } else { ?> | |
<?php echo '<h3>' . '“' . esc_html( $insightquote ) . '”' . '</h3>'; ?> | |
<?php } ?> | |
</div> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment