Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 111 through 120 (of 1,224 total)
  • Author
    Search Results

  • Anonymous
    Inactive

    Hi, I’m trying to display all custom posts separated by custom taxonomy term.
    Format:
    <h2>Term 1</h2>
    {All posts from taxonomy term 1}

    <h2>Term 2</h2>
    {All posts from taxonomy term 2}

    Can you tell me how to incorporate this into the loop in results.php?
    I saw some documentation saying add $args[‘search_filter_id’] = 123 but not sure.
    Thank you! (my loop below)

    $patient_story_types = get_terms('patient_story_type');
    		foreach($patient_story_types as $patient_story_type) :
    		  wp_reset_query();
    		  $patient_story_args = array(
    		  	'post_type' => 'patient_story',
    		  	'posts_per_page' => -1,
    		  	'tax_query' => array(
    		      array(
    		      	'taxonomy' => 'patient_story_type',
    		        'field' => 'slug',
    		        'terms' => $patient_story_type->slug,
    		      ),
    					array(
    		        'taxonomy' => 'patient_story_type',
    		        'terms' => array('featured'),
    		        'field' => 'slug',
    		        'operator' => 'NOT IN',
    					),
    		    ),
    		  );
    		  $custom_query = new WP_Query($patient_story_args);
    		  if($custom_query->have_posts()) : ?>
    		  	
    		  	<h3 class="patient-story-type"><?php echo $patient_story_type->name; ?></h3>
    		  	<div class="patient-stories">
    			  	<?php while($custom_query->have_posts()) : $custom_query->the_post(); ?>
    				
    						<div class="patient-story">
    							<div class="card">
    								<?php if(has_post_thumbnail()) { ?>
    									<a>"><?php the_post_thumbnail('large', array('class'=>'img-responsive aligncenter', 'alt'=>get_the_title(), 'title'=>get_the_title())); ?></a>
    								<?php } ?>
    								<div class="card-body">
    									<?php $patient_story_type_terms = get_the_terms($post->ID, 'patient_story_type'); ?>
    									<h4<?php if($patient_story_type_terms) { echo ' class="has-terms"'; } ?>><a>"><?php the_title(); ?></a></h4>
    									
    									<?php if($patient_story_type_terms) {
    													
    											echo "<ul class='list-inline patient-story-type-terms'>";
    												foreach($patient_story_type_terms as $patient_story_type_term) {
    													echo "<li>". $patient_story_type_term->name ."</li>";
    												}
    											echo "</ul>";
    									} ?>
    									<p><?php pva_custom_excerpt(array('length' => 25, 'suffix' => '&hellip;', 'link_text' => '')); ?></p>
    									<p><a>">Read Full Story</a></p>
    								</div><!-- .card-body -->							
    							</div><!-- .card -->
    						</div><!-- .patient-story -->
    							
    					<?php endwhile; ?>
    		  	</div><!-- .patient-stories -->
    		
    			<?php endif;
    		endforeach; ?>
    #253399

    Trevor
    Participant

    As you are using the Shortcode display results method, you need to follow the customising guide here:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    Then you can edit the newly copied results.php file and translate those strings directly in the file.

    Should you need to, you can edit and change the HTML and PHP as you need.

    #253337

    In reply to: Infinite Scroll Issues


    Trevor
    Participant

    I assume that you are using the shortcode display results method, as described here:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/

    Did you:

    #1 create a search-filter sub folder in your child theme folder
    #2 copy the results-infinite-scroll.php file to that folder
    #3 then rename that file to results.php?

    #252634

    Trevor
    Participant

    To work with Infinite Scroll and our shortcode method, you need to follow these customising instructions:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    BUT … instead of copying the results.php file over, copy the results-infinite-scroll.php file, and then rename it to results.php

    #252410

    Trevor
    Participant

    In place of this line:

    // the current products output code here

    … you would place the code part of the results.php file, which, by default, would be this part:

    if ( $query->have_posts() )
    {
    	?>
    	
    	Found <?php echo $query->found_posts; ?> Results<br />
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
    		<div>
    			<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    			
    			<p><br /><?php the_excerpt(); ?></p>
    			<?php 
    				if ( has_post_thumbnail() ) {
    					echo '<p>';
    					the_post_thumbnail("small");
    					echo '</p>';
    				}
    			?>
    			<p><?php the_category(); ?></p>
    			<p><?php the_tags(); ?></p>
    			<p><small><?php the_date(); ?></small></p>
    			
    		</div>
    		
    		<hr />
    		<?php
    	}
    	?>
    	Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br />
    	
    	<div class="pagination">
    		
    		<div class="nav-previous"><?php next_posts_link( 'Older posts', $query->max_num_pages ); ?></div>
    		<div class="nav-next"><?php previous_posts_link( 'Newer posts' ); ?></div>
    		<?php
    			/* example code for using the wp_pagenavi plugin */
    			if (function_exists('wp_pagenavi'))
    			{
    				echo "<br />";
    				wp_pagenavi( array( 'query' => $query ) );
    			}
    		?>
    	</div>
    	<?php
    }
    else
    {
    	echo "No Results Found";
    }
    #252406

    Anonymous
    Inactive

    Thank you. I am using a child theme and I’m using /wp-content/themes/mythemename/search-filter/results.php to output the results.

    In results.php at the end I see this:

    }
    else
    {
    	echo "No Results Found";
    }
    ?>

    Do I put your code somehow around that code at the end of the file? How would I add this and where? Thanks for your advice.

    #252252

    In reply to: No results found


    Trevor
    Participant

    As you are using the Shortcode display results method, you need to follow the customising guide here:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    Then you can edit the newly copied results.php file and translate those strings directly in the file.

    You can edit and change the HTML as you need, so it would be possible to make text overlays, but not easy.

    #252190

    Anonymous
    Inactive

    Last question. Are you familiar with Essential Grid enough to know where I would copy the script from them to place into the results.php file?

    #252135

    Trevor
    Participant

    As you are using our shortcode method the display of the results comes from our results.php file. You would need to customise it as described (in basic form) here:

    https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results

    I think you need to remove the lines::

    <p><?php the_category(); ?></p>
    <p><?php the_tags(); ?></p>
    <p><small><?php the_date(); ?></small></p>

    You can make any changes you want in this file. Even use your own theme code inside the loop.

    #252103

    Anonymous
    Inactive

    Hello!

    I’m currently working on project, where I need to print a table with information – I’ve made a custom post type with Advanced Custom Fields, which I’m printing in the results.php because I’m using the built-in AJAX filtering from Search & Filter. My goal is to make it possible to sort when clicking on one of the th – first click could be ASC and second could be DESC.

    Anything would help,
    Thanks in advance!

    
    <?php
    if ( $query->have_posts() )
    {
    	?>
    	<div class="lej-table-info-table">
    	<table>
    	    <tr>
                <th>Adresse</th>
                <th>Areal</th>
                <th>Værelser</th>
                <th>Pris</th>
                <th class="no-mo">Type</th>
                <th>Status</th>
            </tr>
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		$status = strip_tags(get_the_term_list( $post->ID, 'status', '', ', ', '' ));
    		?>
            
    			<tr class="table-link" name="<?php global $post; echo $post->post_name; ?>">
                    <td class="no-de"><?php echo $navn = get_field( "navn"); ?></td>
    				<td class="no-mo"><?php echo $navn = get_field( "adresse"); ?></td>
                    <td><?php echo $value = get_field( "areal"); ?> m²</td>
                    <td><?php echo $vaerelser = get_field( "vaerelser"); ?></td>
    			<?php if ($status == 'ledig') { ?>
    				<td class="pris"><?php echo $value = get_field( "kontantpris" ); ?></td>
    			<?php } else { ?>
    				<td></td>
    			<?php } ?>
                    
                    <td class="no-mo"><?php echo $value = get_field( "lejlighedstype" ); ?></td>
                    <!--<td class="<?php echo strip_tags(get_the_term_list( $post->ID, 'status', '', ', ', '' )); ?>" style="text-transform: capitalize"><?php echo strip_tags(get_the_term_list( $post->ID, 'status', '', ', ', '' )); ?></td>-->
    				<td class="<?php echo $status ?>" style="text-transform: capitalize"><?php echo $status ?></td>
                </tr>
    
    		<?php
    	}
    	?>
    	</table>
    	</div>
    	<?php
    }
    else
    {
    	echo "No Results Found";
    }
    ?>
    
Viewing 10 results - 111 through 120 (of 1,224 total)