WordPress.org

Forums

Stripping out html from Editor using a featured cat for home page. (2 posts)

  1. matriplett
    Member
    Posted 2 years ago #

    I'm using the code below to pull 2 most recent featured News post to a custom homepage. It's all working but only on the home page does it strip out html tags (bold/italics). What am i missing.. The formatting is showing up fine on individual blog posts.

      <?php
      $args = array( 'posts_per_page' => 2, 'offset'=> 0, 'category' => 7 );
      $myposts = get_posts( $args );
      foreach ( $myposts as $post ) : setup_postdata( $post ); ?>

    • <header class="article-header"><h2>"><?php the_title(); ?></h2>
      <?php the_date(); ?></header>

      <section class="entry-content clearfix" itemprop="articleBody"><?php the_excerpt(); ?></section>

    • <?php endforeach;
      wp_reset_postdata();?>

  2. Cory Gibbons
    Member
    Posted 2 years ago #

    You need to change

    <?php the_excerpt(); ?>

    to

    <?php the_content(); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.