• Hello, looking for a steer in the right direction getting this loop working. I’m nearly there but not 100% as i’ve got a mysterious box appearing at the top and the bottom of the search results. Would anyone be able to check over to see if the loop is right please?

    I’m displaying results from a custom post type and using the search everything plugin.

    Here is the code:

         <?php get_header(); ?>
          <div class="container-fluid">
     	<div class="row">
    		<div class="col-md-12">
    			<div class="panel panel-default">
    				
    				<div class="panel-body">
    			  <p class="text-muted text-size-small">
                        <?php
                        global $wp_query;
                        echo 'You have '.$wp_query->found_posts.' results found.';?>
                      </p>
    
                      <hr>
    	 <?php if ( have_posts() ) : ?>
    	<?php while ( have_posts() ) : the_post(); ?>    
    	<div class="media-body">
    										
        <h6 class="media-heading text-semibold">
    										<?
        php echo get_post_meta( get_the_id(), 'title', true ); ?>, <?php echo 
        get_post_meta( get_the_id(), 'firstname', true ); ?>, <?php echo 
        get_post_meta( get_the_id(), 'lastname', true ); ?>
    										
        </h6>
    
    										
        <ul class="list-inline list-inline-separate text-muted mb-10">
    											
        <li><a href="#"><?php echo get_post_meta( get_the_id(), 
        'type', true ); ?>  </a></li>
    											
        <li><?php echo get_post_meta( get_the_id(), 'netbios_name', true ); ?> | <?php 
        echo get_post_meta( get_the_id(), 'device_class', true ); ?></li>
    										
        </ul>
              <?php echo get_post_meta( get_the_id(), 'asset_id', true ); ?>
    										<?
        php echo get_post_meta( get_the_id(), 'asset_status', true ); ?>     
    									</div>
    
    									<div 
        class="media-right text-nowrap">
    										<a 
        href="<?php the_permalink();?>" class="btn btn-warning">View</a>
    									</div>
    								</li>
                       <ul class="media-list content-group">
    								<li class="media 
        panel panel-body stack-media-on-mobile">
    									<div 
        class="media-left">
    										<a 
        href="#">
    											
        <img />
    										
        </a>
    									</div>
    	<?php endwhile; ?>
        <?php endif; ?>
    		</div>
    						
     
              
    		</div>
    	</div>
        </div>
    
         <?php get_template_part('footer', 'simple');?>
    
         
    
        <?php get_footer(); ?>

    [Moderated: Please follow the forum guidelines for posting code – https://make.ww.wp.xz.cn/support/handbook/forum-welcome/#post-code-safely/%5D

    • This topic was modified 8 years, 2 months ago by t-p.
    • This topic was modified 8 years, 2 months ago by t-p.
    • This topic was modified 8 years, 2 months ago by t-p.
    • This topic was modified 8 years, 2 months ago by Steven Stern (sterndata).
Viewing 4 replies - 1 through 4 (of 4 total)
  • it will help if you can post a link to a search result page, to illustrate those boxes.
    have you investigated the html of those boxes? for example, by loking into the html output of a search result page in the browser?

    Thread Starter webcrawler2050

    (@webcrawler2050)

    Hello,

    Unfortunately i’m unable to do this, as it’s a private system (portal)

    Here is the output:

    <div class="container-fluid">
    	<div class="row">
    		<div class="col-md-12">
    			<div class="panel panel-default">
    				
    				<div class="panel-body">
    		  <p class="text-muted text-size-small">
                        You have 3 results found.                  </p>
     <hr>
    																		        <div class="media-body">
    										<h6 class="media-heading text-semibold">
    									 										, , 										</h6>
    
    										<ul class="list-inline list-inline-separate text-muted mb-10">
    											<li><a href="#" class="text-muted">  </a></li>
    											<li> | </li>
    										</ul>
              										     
    									</div>
    
    									<div class="media-right text-nowrap">
    										<a href="">View</a>
    									</div>
    								</li>
                       <ul class="media-list content-group">
    								<li class="media panel panel-body stack-media-on-mobile">
    									<div class="media-left">
    										<a href="#">
    											<img src=" class="img-rounded img-lg" alt="">
    										</a>
    									</div>
            <div class="media-body">
    										<h6 class="media-heading text-semibold">
    									 34										, , 										</h6>
    
    										<ul class="list-inline list-inline-separate text-muted mb-10">
    											<li><a href="#" class="text-muted">  </a></li>
    											<li> | </li>
    										</ul>
              										     
    									</div>
    
    									<div class="media-right text-nowrap">
    										<a href="" class="btn btn-warning">View</a>
    									</div>
    								</li>
                       <ul class="media-list content-group">
    								<li class="media panel panel-body stack-media-on-mobile">
    									<div class="media-left">
    										<a href="#">
    											<img src=" class="img-rounded img-lg" alt="">
    										</a>
    									</div>
            <div class="media-body">
    										<h6 class="media-heading text-semibold">
    									 34										Mr, User, User									</h6>
    
    										
       <ul class="list-inline list-inline-separate text-muted mb-10">
    											
        <li><a href="#" class="text-muted">User  </a></li>
    											
        <li> | </li>
    										
        </ul>
              										     
    									</div>
    
    									<div 
        class="media-right text-nowrap">
    										<a 
        href="" class="btn btn-warning">View</a>
    									</div>
    								</li>
                       <ul class="media-list content-group">
    								<li class="media 
        panel panel-body stack-media-on-mobile">
    									<div 
        class="media-left">
    										<a 
        href="#">
    											
         <img src=" class="img-rounded img-lg" alt="">
    										
         </a>
    									</div>
        																		
    															
    		</div>
    						
     
              
    		</div>
    	</div>
    </div>
    
     
         
    
    			</div>
    			<!-- /main content -->
    
    		</div>
    		<!-- /page content -->
    
    	</div>
    	<!-- /page container -->
    Moderator bcworkz

    (@bcworkz)

    You are seeing empty image containers. Your img tags are malformed:
    <img src=" class="img-rounded img-lg" alt="">

    In one place your template code has <img />. I don’t know how you get from this template code to the above output. Maybe some errant JavaScript?

    In any case, you need to either get proper img tag output or remove them.

    Thread Starter webcrawler2050

    (@webcrawler2050)

    I’ve resolved this.

    Figure out what was causing it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Looped Search’ is closed to new replies.