1

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.

1

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: '"';
}
3

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 */
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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