WordPress Query inconsistency -
i having challenges wp_query: when echo title of cpt in first section: posts shown required posts_per_page. when try loop query , make options in select tag, ten titles. causing limit? how can fix it? thanks
<?php $safaris_args = array( 'post_type' => 'safaris', 'posts_per_page' => -1 ); $safaris_query = new wp_query( $safaris_args ); if( $safaris_query->have_posts() ): while( $safaris_query->have_posts() ): $safaris_query->the_post(); echo '<p>' . get_the_title() . '</p>'; endwhile; endif; ?> ------------------------------------------------------------------------ <select id="safari" class="form-control" id="safari" aria-required="true" aria-invalid="false"> <?php $safaris_args = array( 'post_type' => 'safaris', 'posts_per_page' => -1 ); $safaris_query = new wp_query( $safaris_args ); if( $safaris_query->have_posts() ): while( $safaris_query->have_posts() ): $safaris_query->the_post(); ?> <option value="<?php the_title(); ?>" id="<?php the_id(); ?>"><?php the_title(); ?></option> <?php endwhile; endif; ?> </select>
Comments
Post a Comment