• Resolved vinmassaro

    (@vinmassaro)


    Hello,

    I am a newbie with WordPress loops so hopefully someone can help. I am trying to pull news items from WordPress from a specific category and get EACH news item to be wrapped in a div. Right now, it pulls all the news items and places them inside one large div. Thanks in advance! Here is my code:

    <?php if ( query_posts('cat=1') ) { ?>
       <div class="newsitem">
       <?php } ?>
       <?php query_posts('cat=1'); ?>
       <p><?php the_time('F jS, Y'); ?></p>
          <?php while (have_posts()) : the_post(); ?>
          <h4><a>"><?php the_title(); ?></a></h4>
          <?php the_content(); ?>
    
    <?php endwhile;?></div>
Viewing 4 replies - 16 through 19 (of 19 total)
  • Thread Starter vinmassaro

    (@vinmassaro)

    So would you recommend that an excerpt is filled in for every news item and I include the excerpt? How does the excerpt get output?

    just replace “the_content” with “the_excerpt” in your index.php file.

    Thread Starter vinmassaro

    (@vinmassaro)

    Thanks guys, using “the_excerpt” works well. How do I limit the number of posts that are loaded to a specific number?

    If you use my script, you’re able to change the value in the admin panel

    Options -> Reading -> Blog Pages

    Edit: Ok, can’t find another way. Sorry.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Apply DIV to every item in loop?’ is closed to new replies.