WordPress.org

Ready to get started?Download WordPress

Forums

EXPERTS! Bold preamble in single post (6 posts)

  1. sofialos
    Member
    Posted 7 years ago #

    Hi, i this this might be hard to solve. I want when viewing a single post, everything that appears before the <!--more--> tag to be bold (<strong>).

    any ideas?

  2. DianeV
    Member
    Posted 7 years ago #

    So, why not just type the <strong> tags into the post?

  3. sofialos
    Member
    Posted 7 years ago #

    because i have ~8000 posts and post ~10 new each day, what if i 2 months want italic instead, do you think i should edit them all?

  4. Chris_K
    Member
    Posted 7 years ago #

    well... on your theme's index page, style the post/content area(div) with bold. Use a different class in single.php.

  5. sofialos
    Member
    Posted 7 years ago #

    sorry was unclear, it's in the single post i want this, to seperate the preamble from the body.

  6. Kafkaesqui

    Posted 7 years ago #

    A bit of code (replace <?php the_content(); ?> in a theme's single.php template with the following):

    <?php
    $content = explode('<!--more-->', $post->post_content);
    if( !empty($content[1]) ) :
    ?>
    <div class="preamble">
    <?php echo apply_filters('the_content', $content[0]); ?>
    </div>
    <?php echo apply_filters('the_content', $content[1]); ?>
    <?php else : ?>
    <?php the_content(); ?>
    <?php endif; ?>

    Then just style the teaser text through the .preamble css class.

Topic Closed

This topic has been closed to new replies.

About this Topic