• I want to be able to add a quote without having to add quote marks in the post/editor and without a plugin, so I was trying this:

    In one template I have this:

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

    In the output I want this:

    <blockquote>
               <p><span class="bq-start">“</span>... the content ...<span class="bq-end">”</span></p>
    </blockquote>

    What I was trying is this

    function style_blockquote ($content) {
    
    	$content = "<span class=\"bq-start\">“</span>" . $content . "<span class=\"bq-end\">”</span>";
        $content = str_replace("", "", $content);
        return $content;
    
    }
    add_filter('the_content','style_blockquote',0,1);

    Of course this adds quotes to all content. I just want to add new tags to items within blockquotes. Can someone suggest a solution to a newbie?

    Thanks

The topic ‘Need to add span to every blockquote using function’ is closed to new replies.