Viewing 2 replies - 1 through 2 (of 2 total)
  • You are best using back ticks to paste code or use something like paste bin.

    Thanks

    Thread Starter hirezolution

    (@hirezolution)

    true! here it is again

    any help would be awesome! i’m sure it’s something simple…

    <?php $query = new WP_Query( 'cat=1' ); ?>
    <?php if (have_posts('category=1')) : ?>
    <?php $post = $posts[0]; $c=0;?>
    <?php while (have_posts()) : the_post(); ?>
    
    <?php $c++;
    if( !$paged && $c == 1) :?>
    <li class="firstpost">
    "><?php the_post_thumbnail(); ?>
    <h2><?php if (strlen($post->post_title) > 110) {
    echo substr(the_title($before = '', $after = '', FALSE), 0, 110) . '...'; } else {
    the_title();
    } ?></h2>
    <?php the_excerpt(); ?>
    
    <?php else :?>
    <li class="post">
    "><?php the_post_thumbnail(); ?>
    <h2><?php if (strlen($post->post_title) > 45) {
    echo substr(the_title($before = '', $after = '', FALSE), 0, 65) . '...'; } else {
    the_title();
    } ?></h2>
    
    <span class="postfooter"><?php the_time('M j, Y') ?></span>
    
    <?php endif;?>
    
    <?php endwhile; ?>
    
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
    </div>
    
    <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘category query not working in loop’ is closed to new replies.