Search code examples
htmlwordpressfeed

Wordpress news feed


So im trying to create a newsfeed in a static homepage, however I only want to show the title and date posted. I would have explored a widget, but I will later be tieing this news feed in with a slide show and I didn't want to be restricted.

What I have so far:

<div class="news-content">
 <?php query_posts('category_name=News'); ?>
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

     <?php get_template_part( 'content', get_post_format() ); ?>
     <?php twentythirteen_post_nav(); ?>

 <?php endwhile; else: ?>

 <?php endif; ?>
 <?php wp_reset_query(); ?>
</div>

What ever help you can give will be appreciated. Thanks


Solution

  • Using get_the_date() and get_the_title() should work. Your code should look something like:

    <div class="news-content">
     <?php query_posts('category_name=News'); ?>
      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
         <h1><?php echo get_the_title(); ?></h1>
         <h2><?php echo get_the_date(); ?></h2>
        <?php twentythirteen_post_nav(); ?>
    
     <?php endwhile; else: ?>
    
     <?php endif; ?>
     <?php wp_reset_query(); ?>
    </div>