Here is my code for the second loop:
<?php rewind_posts();
$my_query = new WP_Query( array( 'category_name' => 'il belpaese', 'posts_per_page' => 2, 'post__not_in' => $do_not_duplicate ) );
?>
<section class="category-box clear">
<div class="bg-wrapper clear">
<?php
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<section class="sub-cat-post medium-left clear">
<?php $first_post = $wp_query->current_post == 2 && !is_paged() && is_archive(); ?>
<?php if ( $first_post == true ) { ?>
<figure class="featured-image medium-img">
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
<?php the_post_thumbnail( 'category-medium' ); ?>
</a>
</figure>
<div class="entry-title-wrapper">
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
</h3>
<?php if (function_exists( 'button_excerpt_more' ) ) {
echo '<span class="button-more">' . button_excerpt_more() . '</span>';
} ?>
</div>
<?php } else { ?>
<figure class="featured-image">
<a href="<?php echo esc_url( get_permalink() ); ?>" rel="bookmark">
<?php the_post_thumbnail( 'category-small' ); ?>
</a>
</figure>
<h3 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<?php the_title(); ?>
</a>
<?php if (function_exists( '_button_excerpt_more' ) ) {
echo '<span class="button-more">' . button_excerpt_more() . '</span>';
} ?>
</h3>
<?php
if ( has_excerpt( $post->ID ) ) {
echo '<div class="deck">';
echo '<p>' . excerpt(35) . '</p>';
echo '</div><!-- .deck -->';
}
?>
<?php }
?>
</section>
</article><!-- #post-## -->
<?php
endwhile;
?>
</div>
</section>
]]>Thanks
Martin
]]>I’m a novice to WP, but all installed, working well and tweaking more and more.
I have a design that needs the latest blog post to look different to rest on the page (only needs to be on the index page). In effect all I think I need is to add a CSS class/id to the first post and I can take it from there with some CSS styling..
I have noticed this seems to be a fairly common style but I can’t seem to track down how to implement this in the version 3.0 of WP.
Any help would be very much appreciated.
Thanks in advance
I have installed WordPress 2.2 for the first time. The performance works great when the database is newly created, and when the categories are added in and such.
I added in some plugins and changed the themes. However the moment that I make a post, the system takes a long time to make a post and also after that the system slows down to a crawl.
I have tried other versions, but so far the problem is still there.
I am using Ubuntu Server 6.10, apache 2.0.7 and mysql 5.0
Any help would be appreciated.
]]>How can i display the last posted post from one category called category1 and display it in page2 ?
Page2is a content page where i want to show the last related post from one category.
How is this possible? should i write any php code in the page content?