WordPress.org

Support

Support » How-To and Troubleshooting » Strip Tags off Excerpt, reformat with CSS

Strip Tags off Excerpt, reformat with CSS

  • I have a website where I use another content management system for the majority of the site, but have WordPress setup also. I added an SSI tag into the home page of the site:

    <!--#include virtual="/wp-last-5.php" -->

    which causes the file: wp-last-5.php to be parsed and the last (5) post’s titles, date-stamps and excerpts to be inserted into the HTML page, (and use the CSS styling of the rest of the site).

    The file wp-last-5.php contains:

    <?php require('/path/to/wp-blog-header.php'); ?>
    <?php query_posts('showposts=5'); ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <div style="margin: 4px 0; border-style: solid; border-color: c4c4c4; border-width: 0 0 1px 0;">
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a><br />
    <small><?php the_time('F jS, Y') ?> by <?php the_author() ?></small>
    <?php the_excerpt(); ?>
    </div>
    
    <?php endwhile;?>

    …and works fine.

    The problem(s):

    1). I can not get strip_tags(), str_replace() or other php string functions to strip the <p> and </p> tags out of the excerpt.

    2). The excerpts end with […] but this is not clickable (for the implied “Read More…”). I’d like to end each excerpt with a link to the post.

    Is there a reason:

    <?php strip_tags(the_excerpt()); ?>

    will not work (in the loop)?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Strip Tags off Excerpt, reformat with CSS’ is closed to new replies.
Skip to toolbar