otpisani Posted January 3, 2014 Share Posted January 3, 2014 Hello, Need help with this script, I want to move out search bar from script, but when comment out search_bar loose fragment- function (or menus), menus don't filter any more, code is bellow: <?php /* Template Name: */ $k = ''; ?> <?php if(isset($_POST['online1'])) { $k = 1;//Checkbox1 is selected if(isset($_POST['accr'])) { $k = 3; } } else if(isset($_POST['accr'])) { $k = 2; if(isset($_POST['online1'])) { $k = 3; } } else { $k = 4; if($_POST['searchword']) { $k = 5; } } ?> <?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); $data = get_post_meta( $post->ID, 'key', true ); $customBg = $data['custom-background']; $tagline = $data['sub-text'];?> <img src="<?php echo $customBg;?>" id="loadImg" /> <div id="topPanel"> <div class="innerTopPanel"> <h1> <?php the_title(); ?> </h1> <?php if($tagline){?> <h2><?php echo $tagline;?></h2> <?php } ?> </div> <!--end innerTopPanel--> <a href="" class="continueOn"> <?php _e('Continue','themolitor');?> </a> </div> <!--end topPanel--> <div id="mainPanel"> <div id="main"> <div class="content_main"> <div class="wrapper"> <div id="container-1"> <ul class="menu2"> <?php $my_var = get_meta_values( 'Level' ); if( !empty( $my_var ) ) { $meta_counts = array(); $i =1; foreach( $my_var as $meta_value ){ ?> <li><a href=""-<?php echo $i;?>" ><span><?php echo $meta_value;?></span></a></li> <?php $i++; }} ?> </ul> <?php if( !empty( $my_var ) ) { $meta_counts = array(); $j =1; foreach( $my_var as $meta_value ){ ?> <div id="fragment-<?php echo $j;?>"> <!--<div class="search_bar"> --> <form action="" method="post" style="padding:0;"> <!--<div class="search"> <input type="submit" name="button" id="button" value="Submit" /> <input type="text" name="searchword" id="searchword" value="<?php echo $_POST['searchword'];?>"/> </div> --> <div class="check_box_main"> <input type="checkbox" name="online1" id="online1" class="styled" <?php if(isset($_POST['online1'])){?> checked="checked"<?php } ?>/> <label for="checkbox">Online Degrees Only</label> <input type="checkbox" name="accr" id="accr" class="styled" <?php if(isset($_POST['accr'])){?> checked="checked"<?php } ?>/> <label for="checkbox2"><a href="">FEPAC </a>Accreditation Only</label> </div> </form> <!--</div>--> <!--search_bar end--> <div class="main_boxes"> <?php $childcategories = get_categories('child_of=96&hide_empty=1'); foreach ($childcategories as $childcategory) { ?> <?php if($k==1){ $args = array( 'orderby' => 'title', 'order' => 'ASC', 'category_name' => $childcategory->cat_name, 'meta_query' => array( array( 'key' => 'Level', 'value' => $meta_value, 'compare' => 'LIKE' ), array( 'key' => 'Online', 'value' => 'Yes', 'compare' => 'LIKE' ) ) ); }else if($k==2){ $args = array( 'orderby' => 'title', 'order' => 'ASC', 'category_name' => $childcategory->cat_name, 'meta_query' => array( array( 'key' => 'Level', 'value' => $meta_value, 'compare' => 'LIKE' ), array( 'key' => 'Accreditation', 'value' => 'Yes', 'compare' => 'LIKE' ) ) ); }else if($k==3){ $args = array( 'orderby' => 'title', 'order' => 'ASC', 'category_name' => $childcategory->cat_name, 'meta_query' => array( array( 'key' => 'Level', 'value' => $meta_value, 'compare' => 'LIKE' ) ), 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'Accreditation', 'value' => 'Yes', 'compare' => 'LIKE' ), array( 'key' => 'Online', 'value' => 'Yes', 'compare' => 'LIKE' ) ) ); }else if($k==4){ $args = array( 'orderby' => 'title', 'order' => 'ASC', 'category_name' => $childcategory->cat_name, 'meta_query' => array( array( 'key' => 'Level', 'value' => $meta_value, 'compare' => 'LIKE' ) ) ); }else{ $args = array( 'orderby' => 'title', 'order' => 'ASC', 'category_name' => $childcategory->cat_name, 'meta_query' => array( array( 'key' => 'Level', 'value' => $meta_value, 'compare' => 'LIKE' ) ), 's' => $_POST['searchword'] ); } $data = query_posts($args);?> <?php if($data){?> <div class="title_boxes"> <h1><span>schools in: </span> <?php echo $childcategory->cat_name; ?> </h1> </div> <?php }?> <!--title_boxes end--> <?php //query_posts('category_name='.$childcategory->cat_name );?> <div class="box_main"> <?php if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <div class="box"> <div class="box_title"> <h2> <?php the_title();?> </h2> </div> <div class="box_txt"><span style="float:left;padding: 4px 10px 0 0;">Major:</span> <p> <?php the_excerpt();?> <!--<img src="<?php //bloginfo('template_url');?>/images/ad_img.png" alt="" title="" class="ad_img"/>--> </p> <div class="line"></div> <div class="left"> <p><span>Level:</span><br /> <?php echo get_post_meta($post->ID,'Level',true);?></p> </div> <div class="right"> <p><span>Location:</span><br /> <?php echo get_post_meta($post->ID,'Location',true);?></p> </div> <a href="<?php echo get_post_meta($post->ID,'visit_btn_link',true);?>" class="visit_btn">VISIT SITE</a> </div> </div> <?php endwhile; ?> <?php endif; ?> <?php wp_reset_query();?> </div> <?php } ?> <!--box_main end--> </div> <!--main_boxes end--> </div> <?php $j++; }} ?> </div> <!--menu2 end--> </div> <!--wrapper end--> </div> <!--?php endif; ?--> <?php if ('open' == $post->comment_status) { comments_template(); } ?> <div class="clear"></div> </div> <!--end main--> </div> <!--end mainPanel--> <script> jQuery.noConflict(); jQuery(document).ready(function(){ jQuery(window).load(function(){ <?php if($customBg){ $background = $customBg; } else { $background = ot_get_option('background');}?> jQuery.backstretch("<?php echo $background;?>", {speed: 1000}); }); }); </script> <?php endwhile; endif; get_footer(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/285052-help-with-search-bar/ Share on other sites More sharing options...
hakimserwa Posted January 3, 2014 Share Posted January 3, 2014 The question is not clear, The search bar that you want to remove i beleive you talking about html. now if this is an online site can you just post a link to the site? Quote Link to comment https://forums.phpfreaks.com/topic/285052-help-with-search-bar/#findComment-1463669 Share on other sites More sharing options...
otpisani Posted January 3, 2014 Author Share Posted January 3, 2014 (edited) Of course I comment out search bar and it's not showing anymore but fragments-(menus), don't work any more, mean they not filtering. Basically just want out search bar with all functionality untouched. URL: www.forensicnexus.com/school-listing Edited January 3, 2014 by otpisani Quote Link to comment https://forums.phpfreaks.com/topic/285052-help-with-search-bar/#findComment-1463676 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.