Filter the_content() in the Quote Post Format to Display Quotes

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

On the quote post format I would like

Read More
the_content();

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

Thanks.

Related posts

Leave a Reply

2 comments

  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: '"';
    }
    
  2. 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 */
    }