Problem with cycle while in loop.Please help me!
-
Hello everyone,
I have problem ,with cycle while.In fact with endwhile.I need get endwhile after else.This doesnt work.
I can not break after else.I get parser error.
I dont know why? Problem is ,that my cycle while loop,search with helper
id posts. Return all fields, in conditon if its ok,where I give condition.So,echo write only one field,but else me write rest other fields(false),thats why i need break cycle,but doesnt work for me.
I cant stop cycle because get parse error.Why? Im very unhappy.Do you any solutions for me? Notice:Break,also doesnt work.
My code in external file:
<?php //while ( have_posts() ) : the_post(); ?> <?php // get_template_part( 'content', 'search' ); ?> <?php if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : the_post(); ?> <?php $idecko1 =get_the_ID(); $idecko2 ="21311"; $search2 = $_POST['searchval']; ?> <?php if ((isset($post->ID)) && ($post->ID == $_POST['searchval'])) : // OK echo "<div class=\"over-oznam good\">"; $jmeno = get_post_meta($post->ID, 'rw_clen_jmeno', true); $prijmeni = get_post_meta($post->ID, 'rw_clen_prijmeni', true); echo "YES"; echo $jmeno ." ". $prijmeni; echo "</div>"; ?> <?php /*HER I NEED ENDWHILE BUT GET PARSE ERROR!!!*/ else : echo "<div class=\"over-oznam bad\">"; echo "NO for".$search2; echo "</div>"; ?> <?php endif;?> <?php endwhile; ?> <?php endif;?>
My functions.php
function verification_cart_action_do(){ global $wp_query; if ($_POST['searchval']) { $search = $_POST['searchval']; } else { // set to some nonsense to prevent search $search = 'nothing'; } $args_search = array( //'exact' => 1, // 'orderby' => 'id', 'p'=> '$search', // 'limit'=> '1', 'post_type' =>array( 'shop_order' ), // 'posts_per_page' => 2, //'tax_query' => array( 'relation' => 'AND' ), ); $wp_query = new WP_Query( $args_search ); // loading external file get_template_part( 'overeni-karty-results' ); exit(); }
Thank you all!!!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Problem with cycle while in loop.Please help me!’ is closed to new replies.