First Post Different – almost there…
-
I want the first post on the homepage to be different than the rest. I searched the internet and tried MANY code snippets, and finally got the following to work…
<!-- START Top Post --> <?php $top_query = new WP_Query('showposts=1'); ?> <?php while($top_query->have_posts()) : $top_query->the_post(); $do_not_duplicate = $post->ID; ?> <p>FIRST</p> <div class="post-content"> <?php $post_excerpt = of_get_option('post_excerpt'); ?> <?php if ($post_excerpt=='true' || $post_excerpt=='') { ?> <?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,23);?> <?php } ?> <a>" class="button"><?php _e('Read more', 'dirtygirl'); ?></a> </div> <?php endwhile; ?> <!-- END Top Post --> <!-- START Other Posts --> <?php $top_query = new WP_Query('showposts=7&offset=1'); ?> <?php while($top_query->have_posts()) : $top_query->the_post(); $do_not_duplicate = $post->ID; ?> <article id="post-<?php the_ID(); ?>" <?php post_class('post-holder'); ?>> <div class="inner"> <?php $post_image_size = of_get_option('post_image_size'); ?> <?php if($post_image_size=='' || $post_image_size=='normal'){ ?> <?php if(has_post_thumbnail()) { echo '<figure class="featured-thumbnail"><span class="img-wrap"><a href="'; the_permalink(); echo '">'; echo the_post_thumbnail(); echo '</a></span></figure>'; } ?> <?php } else { ?> <?php if(has_post_thumbnail()) { echo '<figure class="featured-thumbnail large"><span class="img-wrap clearfix"><span class="f-thumb-wrap"><a href="'; the_permalink(); echo '">'; echo the_post_thumbnail('post-thumbnail-xl'); echo '</a></span></span></figure>'; } ?> <?php } ?> <div class="extra-wrap"> <header class="entry-header"> <h2><a>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> <?php $post_meta = of_get_option('post_meta'); ?> <?php if ($post_meta=='true' || $post_meta=='') { ?> <div class="post-meta"> <div class="fleft"><time datetime="<?php the_time('Y-m-d\TH:i'); ?>"><?php the_time('d-j-Y'); ?></time> <?php comments_popup_link('0', '1', '%', 'comments-link', 'Comments are closed'); ?></div> </div><!--.post-meta--> <?php } ?> </header> <div class="post-content"> <?php $post_excerpt = of_get_option('post_excerpt'); ?> <?php if ($post_excerpt=='true' || $post_excerpt=='') { ?> <div class="excerpt"><?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,23);?></div> <?php } ?> <a>" class="button"><?php _e('Read more', 'dirtygirl'); ?></a> </div> </div> </div> </article> <?php endwhile; ?> <!-- END Other Posts -->The problem is that I can no longer get past the first page. If I click on page 2, the URL changes, but the content doesn’t (i.e., the EXACT SAME posts show on all pages).
Can someone please take a look at my code and tell me what I’m doing wrong?
Thank you so much for your help!
[Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code may now have been permanently dmaged/corrupted by the forum’s parser.]
The topic ‘First Post Different – almost there…’ is closed to new replies.