Multiple loops, Pagination not working properly
-
Hello,
I have searched the forums and google, but all the methods I tried yielded no result.
I designed my main index page like a magazine style, with multiple loops.
near the end of the page, I made a “latest posts” loop, displaying the recent 5 posts.underneath that loop there is another loop, displaying another 6 posts, each one from different category.
I have placed the pagination at the end of the “Latest posts” loop.
But pressing the pagination keys takes me to a new page and displays the last loop, the one with 6 posts from different categories.I am pulling my hair here, and can’t find solution.
I even tried to use vertical scroll bar to navigate through the latest posts, but this is a poor solution.
PLEASE PLEASE PLEASE help me figure it out.
here is the code for the index page.
I commented the “Latest posts” section in the code.<?php get_header(); ?> <?php if(!is_paged()) { ?> <div id="top" class="clearfloat" style="position:relative;"> <div id="welcome" class="demo-show" style="margin-top:-28px;"> <h3 style="padding-bottom:10px;margin-right:3px;color:#fff;">ברוכים הבאים פרויקט אמת אחרת (לחצו לפתיחה / סגירה) </h3> <div id="welcomeHide" style="font-size:130%"> <p> אנו חיים בתקופה של התעוררות רוחנית אדירה. הרבה מידע שהיה חבוי ונסתר מתגלה כעת. <br /> פרויקט אמת אחרת הוא חלק מרשת עולמית של אתרי מידע וחדשות אלטרנטיביים שמציגים לציבור מידע חשוב שאינו זוכה לחשיפה בתקשורת הממוסדת. <br /> אנו מזמינים אתכם לפתוח צוהר לעולם מרתק של מידע לא מסונן, מהפכני וחשוב שירחיב את נקודת המבט שלכם על האירועים המדהימים שקורים כעת בעולם. <br /> הכל תלוי בנקודת מבט, וככל שנקודת המבט שלנו תהיה רחבה יותר, נוכל לעשות בחירות תואמות לטבע האנושי שבנו. <br /> טבע של חמלה, אהבה ושמחה. </p> <p> <span style="font-size:1.1em"> מבקרים לראשונה באתר?<a href="http://www.emetaheret.org.il/2008/12/11/%d7%a7%d7%a6%d7%aa-%d7%94%d7%91%d7%94%d7%a8%d7%95%d7%aa-%d7%91%d7%a0%d7%95%d7%92%d7%a2-%d7%9c%d7%90%d7%aa%d7%a8/"> כנסו לכאן בבקשה</a> ולאחר מכן קראו את <a href="http://www.emetaheret.org.il/%d7%9e%d7%99-%d7%95%d7%9c%d7%9e%d7%94/">דף שאלות נפוצות</a> שנוצר במיוחד בשביל מי שנחשף לראשונה לאתר ותכניו.</span> </p> <p style="font-weight:bold;">אם ברצונכם להצטרף לצוות שמתרגם את הסרטים, או שכותב את המאמרים, או לעזור בכל צורה אחרת,<br /> אנא צרו עמנו קשר בדף <a href="http://www.emetaheret.org.il/%d7%99%d7%a6%d7%99%d7%a8%d7%aa-%d7%a7%d7%a9%d7%a8/">יצירת קשר</a> או הצטרפו לצוות <a href="http://emetaheret.org.il/wiki">ויקי אמת אחרת</a> </p> <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style" style="float:right;margin-bottom:10px;"> <a href="http://www.addthis.com/bookmark.php?v=250&pub=xa-4b0e08a44f0efa1e" class="addthis_button_compact">שתפו</a> <span class="addthis_separator">|</span> <a class="addthis_button_facebook"></a> <a class="addthis_button_myspace"></a> <a class="addthis_button_google"></a> <a class="addthis_button_twitter"></a> </div> <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pub=xa-4b0e08a44f0efa1e"></script> <script type="text/javascript"> var addthis_config = { ui_language: "he" } </script> <!-- AddThis Button END --> <p style="clear:both;"> הצטרפו לקבוצה של פרויקט אמת אחרת בפייסבוק: <a href="http://www.facebook.com/group.php?gid=53459072720" target="_blank"><img src="http://tbn0.google.com/images?q=tbn:A3kY7ltk62yqnM:http://www.unodc.org/images/yournocounts/facebookLogo.gif" alt="הצטרפו לקבוצה בפייסבוק" width="20px" height="20px" border="0" style="vertical-align:middle; " /></a> </p> </div> </div> </div> <!--******************* RIGHT ************************* --> <div class="clearfloat"> <div id="colomnRight" class="left" style=""> <?php include (TEMPLATEPATH . '/includes/sidebarRight.php'); ?> </div> <!--********************* MIDLLE ********************* --> <div id="colomnMiddle" class="left"> <div id="headline"> <div class="topHeadline"> <h4><span>הסיפור המרכזי »</span></h4> </div> <?php jquery_ui_slider(); ?> </div> <div class="shadow"> <?php include (TEMPLATEPATH . '/searchform.php'); ?> </div> <div id="moviesList"> <div class="emptyHeadline"><h4><span>סרטים נבחרים »</span></h4> </div> <?php $movies = new WP_Query(); $movies->query('showposts=3&cat=198'); ?> <div id="container_division" style=""> <?php if (have_posts()) : while ($movies->have_posts()) : $movies->the_post(); ?> <div class="post-block"> <div class="img"> <a href="<?php the_permalink() ?>" rel="bookmark"> <?php if (has_post_thumbnail()) { the_post_thumbnail(); } else { echo ''; } ?> </a> <div class="title"><?php the_title(); ?> </div> </div> </div> <?php endwhile; else: ?> <?php endif; ?> <?php wp_reset_query(); ?> </div> </div> <div style="clear:both;"></div> <div class="categoriesDiv"> <?php $display_categories = array(188,189,190,191,192); $i = 1; // החלף את מספרי הקטגוריות foreach ($display_categories as $category) { ?> <div class="categoryBox"> <?php $catPosts = new WP_Query(); $catPosts->query("showposts=1&cat=$category"); ?> <div class="catHead catHead<?php echo $category; ?>"></div> <div class="headline<?php echo $category; ?> catHeadline"> <h4><span><a href="<?php echo get_category_link($category);?>"><?php echo get_cat_name($category);?> »</a></span></h4> </div> <a href="<?php echo get_category_link($category);?>"><?php echo category_description($category); ?></a> <?php while ($catPosts->have_posts()) : $catPosts->the_post(); ?> <div class="clearfloat"> <a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_post_thumbnail( 'category-thumbnail' ); ?></a> <div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php echo short_title('...', 12); ?></a> </div> <div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('אין תגובות', 'תגובה אחת', '% תגובות');?>]</div> </div> <?php endwhile; ?> <ul class="categoryBoxUl"> <?php global $post; $myposts = query_posts("showposts=3&cat=$category&offset=1"); foreach($myposts as $post) : setup_postdata($post); ?> <li><span class="categoryTitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></span> <div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('אין תגובות', 'תגובה אחת', '% תגובות');?>]</div> </li> <?php endforeach; ?> </ul> <div style="clear:both;"> <span><a href="<?php echo get_category_link($category);?>">עוד ב<?php single_cat_title(); ?> »</a></span> </div> </div><!-- end of div categoryBox --> <?php $i++; ?> <?php } ?> </div><!-- end of div categoriesDiv --> <!-- LATEST POSTS --> <div class="emptyHeadline"><h4><span>פוסטים אחרונים »</span></h4> </div> <div id="latest" style="overflow-y:auto;height:400px;padding:0px 10px;"> <?php query_posts('posts_per_page=5'); ?> <?php while (have_posts()) : the_post(); ?> <div class="clearfloat"> <div class="title" style="font-weight:700;"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div> <div class="meta"> <ul> <li class="time"><?php the_time('j M Y') ?></li> <li class="comments"><?php comments_popup_link('אין תגובות', 'תגובה אחת', '% תגובות');?></li> <li class="author">מאת <?php the_author_posts_link(); ?></li> </ul> </div> <div class="spoiler"> <?php echo excerpt(25); ?> </div> </div> <?php endwhile;?> <?php wp_reset_query(); ?> <div class="navigation"> <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?> <div class="right"><?php next_posts_link('העמוד הבא »') ?></div> <div class="left"><?php previous_posts_link('« העמוד הקודם') ?></div> <?php } ?> </div> </div> </div><!-- end of div topMiddle --> <!--********************** LEFT *************************** --> <div id="colomnLeft"> <div id="news"> <?php $newsPost = new WP_Query(); $newsPost->query('showposts=5&category_name=מבזקים'); $i = 1; ?> <div class="topHeadline"><h4><span><a href="<?php echo get_category_link(109); ?>"><?php single_cat_title(); ?> »</a></span></h4></div> <?php while ($newsPost->have_posts()) : $newsPost->the_post(); ?> <div class="clearfloat <?=($i%2)?"newsColor1":"newsColor2";$i++;?>" style="position:relative;"> <div class="newsDate"> <?php the_time('j M Y') ?> </div> <a href="<?php the_permalink() ?>" rel="bookmark"> <?php if (has_post_thumbnail()) { the_post_thumbnail('news-thumbnail'); } else { echo ''; } ?></a> <div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"> <?php the_title(); ?></a> <div class="excerpt"> <?php echo excerpt(10); ?> </div> </div> </div> <?php endwhile; ?> </div> <?php if (class_exists('MailPress')) MailPress::form(); ?> <div class="" style="width: 290px;"> <div class="emptyHeadline"><h4>חסויות »</h4></div> <?php wp125_write_ads(); ?> </div> <div style="clear:both;"></div> <?php include(TEMPLATEPATH . '/includes/categoryTabs.php'); ?><!-- categorytabs --> <div style="clear:both;"></div> <div class="categoryBox" style="width: 292px; height:480px; margin-top:20px; border:0;clear:both;"> <div class="emptyHeadline"><h4>אמת אחרת על »</h4></div> <div class="moreOnDiv div1"><a href=""><p>הכלכלה קורסת. האם המשבר הכלכלי מתוכנן? האם באמת יצאנו מהמיתון?</p></a></div> <div class="moreOnDiv div2"><a href=""><p>חוץ מישראל, רק בעוד מדינה אחת בעולם יש חובת הפלרת מים. האם הפלואוריד שמכניסים לנו למים הכרחי לבריאות השיניים או רעל מסוכן?</p></a></div> <div class="moreOnDiv div3"><a href=""><p>חיסונים. אי אפשר בלעדיהם, או שהם מסוכנים ביותר לבריאותינו ובריאות ילדינו?</p></a></div> <div class="moreOnDiv div4"><a href=""><p>מים נקיים. מקור החיים וזכותו הבסיסית של כל אדם. האם באמת יש משבר מים בישראל, או שמדובר בעוד דרך להוציא מאיתנו כסף?</p></a></div> <div class="moreOnDiv div5"><a href=""><p>אנרגיה חופשית כבר כאן. והיא קיימת כבר עשרות שנים. למי יש אינטרס שהציבור לא יידע מכך?</p></a></div> <div class="moreOnDiv div6"><a href=""><p>המאגר הביומטרי זה לא חטיף. מדובר באיסוף נתונים כללי על כל אזרח והכנסתו למאגר ממוחשב. מי מתנגד למהלך ומדוע?</p></a></div> <div class="moreOnDiv div7"><a href=""><p>חלק מהויטמינים ומתוספי המזון משמשים כטיפול יעיל למגוון מחלות. ועדת הקודקס אלימנטריוס רוצה למנוע ממכם גישה אליהם. מהי וועדה זו ומה מטרותיה?</p></a></div> </div> </div><!-- end of div topLeft --> </div> <div id="middle" class="clearfloat"> <div class="left" style="width:610px;"> <!-- Categories --> </div> <div id="middleLeft" class="left" style="width:300px;"> </div><!-- end of div middleLeft --> </div> <?php } ?> <div id="front-list"> <div class="topHeadline"><h4><span>חדשות מקטגוריות אחרות »</span></h4></div> <div class="catCont"> <?php $display_categories = array(197,202,201,200,199,193); $i = 1; // החלף את מספרי הקטגוריות foreach ($display_categories as $category) { ?> <div class="otherCatBox"> <?php $otherPosts = new WP_Query(); $otherPosts->query("showposts=1&cat=$category"); ?> <div class="catHead catHead<?php echo $category; ?>"></div> <div class="headline<?php echo $category; ?> catHeadline"> <h4><span><a href="<?php echo get_category_link($category);?>"><?php echo get_cat_name($category);?> »</a></span></h4> </div> <a href="<?php echo get_category_link($category);?>"><?php echo category_description($category); ?></a> <?php while ($otherPosts->have_posts()) : $otherPosts->the_post(); ?> <div class="clearfloat" style="font-size:0.7em;width:140px;"> <a href="<?php the_permalink() ?>" rel="bookmark"> <?php the_post_thumbnail( 'category-thumbnail' ); ?></a> <div class="info"><a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php echo short_title('...', 12); ?></a> </div> <div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('אין תגובות', 'תגובה אחת', '% תגובות');?>]</div> </div> <?php endwhile; ?> </div><!-- end of div categoryBox --> <?php $i++; ?> <?php } ?> </div> </div> <!-- </div> --> <?php get_footer(); ?>The site in action: http://www.emetaheret.org.il/blog_new
The topic ‘Multiple loops, Pagination not working properly’ is closed to new replies.