• Hi, there.
    I cannot figure out how to put some quotes around a post excerpt called with the_content() in the Loop.

    The problem is, the obvious syntax
    <div>“<?php the_content(); ?>”</div>
    will not do, because the html the_content() returns begins and ends with p tags, thus throwing my quotes to a new line.

    Typing the quotes in the post text won’t work either, because I only want them to show up in this particular part of the theme.

    Any hints?
    Thanks a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Ok, I solved the first one.

    I put the the opening quote in span tags with a ‘quote’ class, and then style the first paragraph in the content thus:
    span.quote + p { display:inline };

    Same trick won’t do for the closing quote, though; still brainstorming it.

    Moderator keesiemeijer

    (@keesiemeijer)

    in stead of <?php the_content(); ?> use this:

    <?php
    $content = get_the_content();
    $content = '"' . $content . '"';
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    echo $content;
    ?>

    or you can create a sprite( or separate two images ) for opened and closed quotes and use them as background using CSS
    for example: p:first-child and ‘p:last-child’ or any other selectors.

    Nice piece of code there, keesiemeijer, that did the trick.
    Thanks a lot!

    @reuben, yeah, I had that same idea, but I’m using some bg already there and it would be quite a mess. Thanks for the tip anyway.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Quotes around excerpt’ is closed to new replies.