Forums

[resolved] Showposts without images (5 posts)

  1. Basboy
    Member
    Posted 2 years ago #

    I show the latest 4 blogpost on a other page of my website. This all worked fine, until I got a image before my 'readmore' line.

    I don't want to show a image over here, and ofcourse not the code. Now at my website it says:
    [caption id="attachment_324" align="alignnone" width="480" caption="Google Siteprestaties grafiek"][/caption] Google is..

    Here is my code at the website page:

    <?php query_posts('showposts=4'); ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <div class="blogleft">
    
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Link naar <?php the_title(); ?>" class="title"><?php the_title(); ?></a><br />
      <?php $content = get_the_content();
      $content = strip_tags($content);
      echo substr($content, 0, 220);
      ?>…
    <br />
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Link naar <?php the_title_attribute(); ?>">Read more</a>
    
    </div>
    
    <?php endwhile;?>
  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Try changing:

    $content = strip_tags($content);

    to

    $content = strip_tags( strip_shortcodes( $content ) );

  3. Basboy
    Member
    Posted 2 years ago #

    How did you know that :O
    Thanks, it works now!

  4. Basboy
    Member
    Posted 2 years ago #

    I get an other error on my other page on my website..
    With the sexybookmarks:

    Warning: Cannot modify header information - headers already sent by (output started at /home/domains/<my site>/public_html/index.php:6) in /home/domains/<my site>//public_html/blog/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 74

  5. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic