Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Header configuration & styling »

How to show alternating items of two categories on one page


 
Prev Previous Post   Next Post Next
  #1  
Old Oct 22, 2009, 06:14 AM
Sakshin
 
66 posts · Aug 2009
Amsterdam, Netherlands
How to show alternating items of two categories on one page

I' made something myself but it comes out as a mess. have a look at newspiration.com/news/archive/ and you see what I mean. Below is the template I used but it doesn't give me the result I would like to see; alternating items of two categories on one page. Isn't there a neater way of doing this with perfect result?

<?php
/*
Template Name: twocol_archive
*/
?>

<?php /* get all options: */
include (TEMPLATEPATH . '/functions/bfa_get_options.php');
get_header(); ?>

<div class="txtboxarchive1">

<p><h3>This week's inspiring news</h3></p>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=news&showposts=1');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=inspiration&showposts=1');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?><br />
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=news&showposts=1&offset=1' );
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=inspiration&showposts=1&of fset=1');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?><br />
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=news&showposts1&offset=2') ;
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=inspiration&showposts1&off set=2');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?><br />
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=news&showposts=1&offset=3' );
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=inspiration&showposts=1&of fset=3');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?><br />
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=news&showposts=1&offset=4' );
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); ?>
<?php endwhile; ?>
<?php } ?>

<?php if ( is_page('197') ) { ?>
<?php $my_query = new WP_Query('category_name=inspiration&showposts=1&of fset=4');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; ?>
<?php } ?>

<?php /* If there are any posts: */
if (have_posts()) : $bfa_ata['postcount'] == 1; /* Postcount needed for option "1 first posts full posts" */ ?>

</div>


<div class="clear"></div>
<?php /* END of: If there are any posts */
else : /* If there are no posts: */ ?>

<?php /* This outputs the "Not Found" content, if neither posts, pages nor attachments are available for the requested page.
This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
bfa_center_content($bfa_ata['content_not_found']); ?>

<?php endif; /* END of: If there are no posts */ ?>



<?php get_footer(); ?>
 

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do not show one or more categories in recent post list megatrader Page & Category Menu Bars 4 Oct 5, 2009 11:16 AM
[SOLVED] Alternating color for post on homepage viscouse Post-Kicker, -Byline & -Footer 3 Jun 25, 2009 07:08 PM
pagination problem - page 2 of categories don't show up! collymore Page & Category Menu Bars 2 May 17, 2009 08:38 AM
Show empty categories olsonsp4c Page & Category Menu Bars 2 Apr 22, 2009 10:41 PM
how to show only categories with a high number of posts ? elpidiofilho Atahualpa 3 Wordpress theme 4 Mar 17, 2009 02:43 PM


All times are GMT -6. The time now is 11:10 PM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.