Skip to main content

Hi the code iI am using below will show the last 5 post in whatever catergory icategory I choose, but iI was wondering, How can iI get it so that the first post shows different from the other 4.?

I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on herehere but it's closed, so iI couldn't comment and ask questions.

Here is the code I'm using

<?php
$queryObject = new  Wp_Query( array(
    'showposts' => 5,
    'post_type' => array('post'),
    'category_name' => videos,
        'orderby' => 1,
    ));

// The Loop
if ( $queryObject->have_posts() ) :
  $i = 0;
  while ( $queryObject->have_posts() ) :
      $queryObject->the_post();
      ?>
      <?php if ( $i == 0 ) : ?>
          <div class="first-post">
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
          <?php the_post_thumbnail('sidethumbs'); ?>
      </a>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <?php if ( $i == 0 ) : ?>
          </div>
      <?php endif; ?>    
      <?php $i++; ?>
  <?php endwhile; ?>

It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to to explain, can anyone help me.

post found here ---> Make First post different from rest?

Hi the code i am using below will show the last 5 post in whatever catergory i choose, but i was wondering, How can i get it so that the first post shows different from the other 4.

I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on here but it's closed so i couldn't comment and ask questions.

Here is the code I'm using

<?php
$queryObject = new  Wp_Query( array(
    'showposts' => 5,
    'post_type' => array('post'),
    'category_name' => videos,
        'orderby' => 1,
    ));

// The Loop
if ( $queryObject->have_posts() ) :
  $i = 0;
  while ( $queryObject->have_posts() ) :
      $queryObject->the_post();
      ?>
      <?php if ( $i == 0 ) : ?>
          <div class="first-post">
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
          <?php the_post_thumbnail('sidethumbs'); ?>
      </a>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <?php if ( $i == 0 ) : ?>
          </div>
      <?php endif; ?>    
      <?php $i++; ?>
  <?php endwhile; ?>

It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to to explain, can anyone help me.

post found here ---> Make First post different from rest?

the code I am using below will show the last 5 post in whatever category I choose, but I was wondering, How can I get it so that the first post shows different from the other 4?

I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on here but it's closed, so I couldn't comment and ask questions.

Here is the code I'm using

<?php
$queryObject = new  Wp_Query( array(
    'showposts' => 5,
    'post_type' => array('post'),
    'category_name' => videos,
        'orderby' => 1,
    ));

// The Loop
if ( $queryObject->have_posts() ) :
  $i = 0;
  while ( $queryObject->have_posts() ) :
      $queryObject->the_post();
      ?>
      <?php if ( $i == 0 ) : ?>
          <div class="first-post">
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
          <?php the_post_thumbnail('sidethumbs'); ?>
      </a>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <?php if ( $i == 0 ) : ?>
          </div>
      <?php endif; ?>    
      <?php $i++; ?>
  <?php endwhile; ?>

It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to explain, can anyone help me.

replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

Hi the code i am using below will show the last 5 post in whatever catergory i choose, but i was wondering, How can i get it so that the first post shows different from the other 4.

I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on here but it's closed so i couldn't comment and ask questions.

Here is the code I'm using

<?php
$queryObject = new  Wp_Query( array(
    'showposts' => 5,
    'post_type' => array('post'),
    'category_name' => videos,
        'orderby' => 1,
    ));

// The Loop
if ( $queryObject->have_posts() ) :
  $i = 0;
  while ( $queryObject->have_posts() ) :
      $queryObject->the_post();
      ?>
      <?php if ( $i == 0 ) : ?>
          <div class="first-post">
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
          <?php the_post_thumbnail('sidethumbs'); ?>
      </a>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <?php if ( $i == 0 ) : ?>
          </div>
      <?php endif; ?>    
      <?php $i++; ?>
  <?php endwhile; ?>

It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to to explain, can anyone help me.

post found here ---> Make First post different from rest?Make First post different from rest?

Hi the code i am using below will show the last 5 post in whatever catergory i choose, but i was wondering, How can i get it so that the first post shows different from the other 4.

I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on here but it's closed so i couldn't comment and ask questions.

Here is the code I'm using

<?php
$queryObject = new  Wp_Query( array(
    'showposts' => 5,
    'post_type' => array('post'),
    'category_name' => videos,
        'orderby' => 1,
    ));

// The Loop
if ( $queryObject->have_posts() ) :
  $i = 0;
  while ( $queryObject->have_posts() ) :
      $queryObject->the_post();
      ?>
      <?php if ( $i == 0 ) : ?>
          <div class="first-post">
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
          <?php the_post_thumbnail('sidethumbs'); ?>
      </a>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <?php if ( $i == 0 ) : ?>
          </div>
      <?php endif; ?>    
      <?php $i++; ?>
  <?php endwhile; ?>

It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to to explain, can anyone help me.

post found here ---> Make First post different from rest?

Hi the code i am using below will show the last 5 post in whatever catergory i choose, but i was wondering, How can i get it so that the first post shows different from the other 4.

I want the first post to show the thumbnail and the title under it and the rest to show titles. I found a code on a recent post on here but it's closed so i couldn't comment and ask questions.

Here is the code I'm using

<?php
$queryObject = new  Wp_Query( array(
    'showposts' => 5,
    'post_type' => array('post'),
    'category_name' => videos,
        'orderby' => 1,
    ));

// The Loop
if ( $queryObject->have_posts() ) :
  $i = 0;
  while ( $queryObject->have_posts() ) :
      $queryObject->the_post();
      ?>
      <?php if ( $i == 0 ) : ?>
          <div class="first-post">
      <?php endif; ?>
      <a href="<?php the_permalink(); ?>" title="<?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">
          <?php the_post_thumbnail('sidethumbs'); ?>
      </a>

      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
      <?php if ( $i == 0 ) : ?>
          </div>
      <?php endif; ?>    
      <?php $i++; ?>
  <?php endwhile; ?>

It's working but the problem is, I don't know where to begin the second styling or how to begin it which the person failed to to explain, can anyone help me.

post found here ---> Make First post different from rest?

edited tags
Link
Pat J
  • 12.3k
  • 2
  • 28
  • 36
Source Link
user32447
  • 835
  • 1
  • 12
  • 16
Loading