alessia_e
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Two loops, how to offset 1 loop by 10 comments (on Page 2)?Essentially, I’d like for it to look like this:
Page1:
MAIN POST (1)
2 | 3
4 | 5
6 | 7
8 | 9
10| 11Page2:
Mainpost (12)
13 | 14
15 | 16…
I have the second loop working well, but not the first one :*(
New code (I modified it by trial and error!)
Loop1:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // pagination query_posts( 'cat=-9,-10&showposts=1&posts_per_page=11&paged=' .$paged ); if (have_posts()) : while (have_posts()) : the_post(); $category = get_the_category(); ?>Loop2:
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // pagination query_posts( 'cat=-9,-10&posts_per_page=10&paged=' .$paged); if (have_posts()) : $counter = 0; while (have_posts()) : the_post(); $category = get_the_category(); if( $counter % 2 == 0 ) $end = ""; else $end = "last"; ?>Previous/Next:
<?php previous_posts_link( __( '<img src="http://www.shalasrabbithole.com/blog/images/old_leaf.jpg" width="132" height="26" align="left" border="0"/>' ) ); ?> <?php next_posts_link( __( '<img src="http://www.shalasrabbithole.com/blog/images/new_leaf.jpg" width="133" height="26" align="right" border="0"/>' ) ); ?>Lesson: Watch out for the offset values – it screwed me up.
Forum: Hacks
In reply to: Navigation blog page: previous – nextHello,
I am having a similar issue, and I’ve tried adding the “paged” code but it is still not working. I have two loops on my site, please take a look & let me know where I am going wrong… Thank you very much!
Site: shalasrabbithole.com/blog
Loop 1 (large main post)
<?php query_posts( 'cat=-9,-10&showposts=1' ); if (have_posts()) : while (have_posts()) : the_post(); $category = get_the_category(); ?> <div class="wrapper" style="margin-bottom:25px;"> <?php if( get_post_meta( $post->ID, "image_value", true ) ) : ?> <div class="image"> <a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=930&h=500&zc=1" alt="<?php the_title(); ?>" class="img_main" /></a> </div> <?php endif; ?> <div class="post_header"> </div> <div class="post_large"> <div class="headline"> <h1><?php the_title(); ?></h1> </div> <div class="posted"> posted on <?php the_time( 'l F j, Y' ) ?> | in <?php the_category(',') ?> | <?php comments_popup_link(__( '0 Comments' ), __( '1 Comment' ), __( '% Comments' )); ?> </div> <p> <?php the_excerpt(); ?> <a>#more-<?php the_ID(); ?>" rel="bookmark" title="Continue Reading <?php the_title_attribute(); ?>"> Continue Reading →</a> </p> </div> <div class="post_ripped"> </div> </div> <?php endwhile; endif; ?>Loop 2 (smaller posts, two on each line)
<?php query_posts( 'cat=-9,-10&showposts=10&offset=1' ); if (have_posts()) : $counter = 0; while (have_posts()) : the_post(); $category = get_the_category(); if( $counter % 2 == 0 ) $end = ""; else $end = "last"; ?> <div class="left clearfix"> <?php if( get_post_meta( $post->ID, "image_value", true ) ) : ?> <div style="width:490px;"> <a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo( 'template_directory' ); ?>/timthumb.php?src=<?php echo get_post_meta( $post->ID, "image_value", true ); ?>&w=450&h=300&zc=1" alt="<?php the_title(); ?>" class="img_secondary" /></a> </div> <?php endif; ?> <div class="post_header" style="width:95%;"> </div> <div class="post" style="width:83%;"> <div class="headline" style="width:375px;" > <h2><?php the_title(); ?> </h2> </div> <div class="posted2"> <?php the_time('F j, Y') ?> | <?php the_category(',') ?> | <?php comments_popup_link(__( '0 Comments' ), __( '1 Comment' ), __( '% Comments' )); ?> </div> <p> <?php the_excerpt(); ?> <a>#more-<?php the_ID(); ?>" title="Continue Reading <?php the_title_attribute(); ?>" class="color" rel="bookmark">Continue Reading →</a></p> </div> <div class="post_ripped" style="width:95%;"> </div> </div> <?php // Clear the left float to allow for different heights if( $counter % 2 != 0 ) echo'<div style="clear:left;"> </div>'; ?> <?php $counter++; endwhile; endif; ?>OK, apparently I just solved my own problem (again on this blog, twice now!) without much knowing what I did… Just copied & pasted a similar code I used for inspiration for creating my blog (Magazeen, on Smashing Mag website).
Here is the new code, in case anyone is looking for solutions:
[Code moderated as per the Forum Rules. Please use the pastebin]
Thank you A, I fixed the DIV IDs and the errors are “better” now.. But still my problem continues.
After some research, I am pretty sure it has something to do with floating containers, that is why the alignment is off. I am playing around with the code, but so far nothing. Any suggestions would be helpful!This is my current loop for the two column boxes:
[Code moderated as per the Forum Rules. Please use the pastebin]
Forum: Fixing WordPress
In reply to: Two-column horizontal loop changes into single vertical loop, help!I don’t really know HOW I fixed it, but I did… Here is the code:
<div id=”wrapper”>
<?php query_posts(‘showposts=10&offset=1’); ?>
<?php while (have_posts()) : the_post(); ?><div id=”left”>
<?php if( get_post_meta( $post->ID, “image_value”, true ) ) : ?>
<?php endif; ?>
<div id=”headline”>
<h2><?php the_title(); ?></h2>
</div><div class=”posted2″>
<?php the_time(‘F j, Y’) ?>
|
<?php the_category(‘,’) ?> | <?php comments_popup_link(__( ‘0 Comments’ ), __( ‘1 Comment’ ), __( ‘% Comments’ )); ?>
</div><div id=”post”>
<p>
<?php the_excerpt(); ?>
</p>
<p>
#more-<?php the_ID(); ?>” title=”Continue Reading <?php the_title_attribute(); ?>” class=”color” rel=”bookmark”>Continue Reading →</p></div>
</div>
<?php endwhile; ?>
</div>
Forum: Fixing WordPress
In reply to: Two-column horizontal loop changes into single vertical loop, help!The website is shalasrabbithole.com by the way, if you’d like to take a look.