My startpage loops twice
-
Hi!
I’m going crazy here right now. I have a problem with my start loop, that wants to show the content twice. Is there anyone that knows why this problem occurs?Here’s my code:
<!--<div class="spacer"></div> <div class="content transparent"> <div class="content-inner"> <h1><strong>Header</strong></h1> </div></div>--> <?php if (in_category('sticky')) { ?> <div class="content transparent splash"><?php the_post_thumbnail( 'full', array( 'class' => 'hundred-width' ) ); ?> <div class="intro"><h1><strong><?php the_title(); ?></strong></h1> <h2><?php the_field('ingress'); ?></h2> <?php the_content(); ?></div></div> <?php } else {?> <article id="post-<?php the_ID(); ?>"> <div class="content-inner transparent animatedParent animateOnce data-appear-top-offset='30'"> <div class="two-column-left-img animated fadeInDownShort go"> <?php // Post thumbnail. the_post_thumbnail( 'large', array( 'class' => 'hundred-width' ) ); ?> </div> <div class="two-column-right animated fadeInUpShort go"> <h1><?php the_title(); ?></h1> <p><?php the_excerpt(); ?></p> <a class="button orange" href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Läs mer</a> <?php } ?> </li> </ul> </div> </div> </div> <div class="content transparent"> <div class="content-inner front animatedParent data-sequence='500'"> <?php $counter = 1; $new_query = new WP_Query(array('post_type' => 'my_content')); while ($new_query->have_posts()) : $new_query->the_post(); ?> <div class="four-column-front transparent animated fadeInUpShort go data-id='<?php echo $counter?>'"> <div style="height: 250px; position: relative;"> <?php the_post_thumbnail( 'large', array( 'class' => 'hundred-width' ) ); ?></div> <a href="<?php the_permalink(); ?>"><h4>Test<br> <?php the_title(); ?></h4></a></div> <?php $counter++; endwhile; wp_reset_query();?> <div class="clear"></div> </div> </div> </article> <div class="clear"></div> <div class="content"><div class="content-inner"> <div class="three-column front-box l-grey animated fadeInUpShort go"> <img class="sub-bg" src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/sub-menu/three_column_img.jpg" alt="FAQ" /> <a class="button orange">FAQ</a></div> <div class="three-column front-box l-grey animated fadeInUpShort go"> <img class="sub-bg" src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/sub-menu/three_column_img.jpg" alt="Frågor & svar" /> <a class="button orange">Test?</a></div> <div class="three-column front-box l-grey animated fadeInUpShort go"> <img class="sub-bg" src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/sub-menu/three_column_img.jpg" alt="Frågor & svar" /> <a class="button orange">Test</a></div> </div></div> <?php $new_query = new WP_Query(array('post_type' => 'faq', 'orderby' => 'rand', 'showposts' => '1')); while ($new_query->have_posts()) : $new_query->the_post(); ?> <div class="content faq orange"> <div class="content-inner"> <div class="two-column-left animated fadeInLeftShort go"><h2><?php the_title(); ?></h2></div> <div class="two-column-right animated fadeInRightShort go"><?php the_content(); ?></div> <div class="clear"></div> <a href="/web/faq/" class="button l-grey">Läs FAQ</a></h2> </div> </div> <?php endwhile; wp_reset_query();?> <?php $new_query = new WP_Query(array('post_type' => 'quotes', 'orderby' => 'rand', 'showposts' => '1')); while ($new_query->have_posts()) : $new_query->the_post(); $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); ?> <div class="parallax-fullwidth animatedParent" data-parallax="scroll" data-speed="0.5" data-image-src="<?php echo $url; ?>" data-natural-width="1500" data-natural-height="1000" data-position="0px 20px"> <div class="content-inner"> <div class="two-column-left"><h3><?php the_content(); ?></h3> <p><?php the_title(); ?></p> <a href="/web/quotes/" class="button orange">Quotes</a></h2> </div> <div class="clear"></div> </div> </div> <?php endwhile; wp_reset_query();?> <!--<?php /* translators: %s: Name of current post */ the_content( sprintf( __( 'Continue reading %s', 'betavivo' ), the_title( '<span class="screen-reader-text">', '</span>', false ) ) ); wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'betavivo' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>', 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'betavivo' ) . ' </span>%', 'separator' => '<span class="screen-reader-text">, </span>', ) ); ?> --> <!--<?php // Author bio. if ( is_single() && get_the_author_meta( 'description' ) ) : get_template_part( 'author-bio' ); endif; ?>--> <section class="entry-footer"> <!--<?php betavivo_entry_meta(); ?> --> <?php edit_post_link( __( 'Redigera produkt →', 'betavivo' ), '<span class="edit-link">', '</span>' ); ?> </section><!-- .entry-footer --> </div><!-- .entry-content --> </div> </article><!-- #post-## --> <?php wp_reset_postdata(); ?>Thank you soo much for the help!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘My startpage loops twice’ is closed to new replies.