• Hi all,
    I’m working on a page with twoo loops, the first is the default loop managed by the theme, the second one is a custom loop to load a custom post type.

    The second loop ignores my custom post type and loads the default post types.

    There is some hooks in customizr that change WP_Query arguents?

    The code for secondo loop is:

    $columns = 3;
                $query_vars = array(
                    'post_type'=>'attrazioni',
                    'category_name'=>'home',
                    'posts_per_page'=>10
                );
    
                $my_loop = new WP_Query($query_vars);
                $i=1;
                while ($my_loop->have_posts()) : $my_loop->the_post();
                    //insert section every four structures
                    if($i==1) {?> <section class="row-fluid grid-cols-3"> <?php } $i++; ?>
                        <article class="span4 hot-category-article">
                            <a href="<?php $my_loop->the_permalink(); ?>" rel="bookmark" title="<?php $my_loop->the_title_attribute(); ?>">
                                <div class="hot-category-image" style="background-image: url('<?php $my_loop->the_post_thumbnail_url(); ?>')!important";>
                                    <?php //the_post_thumbnail(); ?>
                                </div>
                            </a>
                            <h2><a href="<?php $my_loop->the_permalink(); ?>" rel="bookmark" title="<?php $my_loop->the_title_attribute(); ?>"><?php $my_loop->the_title(); ?></a></h2>
                            <div class="hot-category-excerpt hidden-sm hidden-xs"><?php $my_loop->the_excerpt(); ?></div>
                        </article>
                    <?php if($i == $columns + 1) { ?>
                    </section>
                    <?php $i=1;  ?>
                    <?php }
                endwhile;
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘page with multiple loops’ is closed to new replies.