Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm customizing a theme for a client and I want to leverage post formats.

On the quote post format I would like

the_content();

to be wrapped in a two spans that contains quotation marks that I could style and position. Is this possible?

Thanks.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Try

$content = get_the_content();
$content = '<span>"</span>'.$content.'<span>"</span>';

echo apply_filters('the_content', $content);

CSS Solution:

<blockquote>
    <?php the_content(); ?>
</blockquote>

blockquote:before{
   content: '"';
}

blockquote:after{
   content: '"';
}
share|improve this answer
add comment

Similar to @sisir but a slightly different take on a few of the specifics. For functions.php:

add_action( 'the_content', 'add_quotes_to_quote' );
function add_quotes_to_quote( $content ) {
    if( get_post_format() == "quote" ) {
        return '<span class="openquote">"</span>' . $content . '<span class="closequote">"</span>';
    }
}

If you're using post_class() and don't need perfect browser support, you can use CSS something like this (.entry-content being some wrapping element around your body content):

.format-quote .entry-content:before,.format-quote .entry-content:after {
    display:inline-block;
    content:'"';
    /* your styles */
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.