Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   Trying to modify the loop (http://forum.bytesforall.com/showthread.php?t=3110)

sspeedy Aug 23, 2009 01:01 PM

Trying to modify the loop
 
Hey everyone,

I'm reading the codex regarding the loop and while I think I understand the code examples there, I'm having a hard time integrating it with this theme.

Currently I'm using the same loop but I need it to be modified so that it displays 5 posts from each of these categories: featured post, news, deals.

Here is the default code, can someone help me modify it to what I need it to be? TIA.

Code:

<?php /* Post Container starts here */ if ( function_exists('post_class') ) { ?>
        <?php query_posts('category_name=Deals&showposts=1'); ?>
 
        <div <?php if ( is_page() ) { post_class('post'); } else { post_class("$odd_or_even"); } ?> id="post-<?php the_ID(); ?>">
        <?php } else { ?>
        <div class="<?php echo ( is_page() ? 'page ' : '' ) . $odd_or_even . ' post" id="post-'; the_ID(); ?>">
        <?php } ?> <?php bfa_post_kicker('<div class="post-kicker">','</div>'); ?>
        <?php bfa_post_headline('<div class="post-headline">','</div>'); ?>
        <?php bfa_post_byline('<div class="post-byline">','</div>'); ?>
        <?php bfa_post_bodycopy('<div class="post-bodycopy clearfix">','</div>'); ?>
        <?php bfa_post_pagination('<p class="post-pagination"><strong>'.__('Pages:','atahualpa').'</strong>','</p>'); ?>       
        <?php bfa_post_footer('<div class="post-footer">','</div>'); ?>

        </div><!-- / Post -->


Flynn Aug 23, 2009 03:34 PM

The code in the text area The LOOP is just the loop. query_posts code needs to be put before the loop, in Atahualpa's case into the text area above, named Content ABOVE the LOOP

sspeedy Aug 24, 2009 01:57 PM

Oh.. I wasn't aware of that at all. I'll have to give that a try today. That's probably why it's pretty messed up. Thanks, Flynn.

sspeedy Aug 24, 2009 07:12 PM

What Flynn said was correct. However, what if I have multiple loops? So for now, I want three loops:

Code:

<?php query_posts_deals('category_name=Deals&showposts=1'); ?>

<?php rewind_posts(); ?>
<?php query_posts_news = new WP_Query('category_name=news&showposts=1');

<?php rewind_posts(); ?>
<?php query_posts_featured_posts = new WP_Query('category_name=Featured Posts&showposts=1');

Should all three appear in the ABOVE LOOP section? Right now I think it shows the proper posts but also displays an error:

Parse error: syntax error, unexpected '=' in C:\xampplite\htdocs\wordpress\wp-content\themes\atahualpa.3.4.1\atahualpa\functions .php(389) : eval()'d code on line 14

How do I do this properly? My display could be wrong, because I only have one post for each category right now anyway. But anyway... any ideas?

sspeedy Aug 26, 2009 08:24 AM

Flynn or anyone, is what I'm asking for possible using Atahualpa?

Flynn Aug 27, 2009 06:38 PM

For multiple loops you should create a new page template. Creating page templates has been discussed a few times here and there are also a few pages on the Wordpress.org codex. Keep in mind that multiple loops aren't easy especially if you want to keep proper next/previous page navigation.


All times are GMT -6. The time now is 04:00 PM.

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