Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 271 through 280 (of 1,224 total)
  • Author
    Search Results
  • #220852

    Anonymous
    Inactive

    Hi Trevor,

    You are totally right. I made a mistake in customizing the results.php

    Thanks a lot for checking and pointing in the right direction.

    Best regards

    #220782

    Trevor
    Participant

    Ah, OK.

    I think you should use our Shortcode method instead. See here and also follow the guide for customising:

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

    Then, either edit the results.php file yourself, or contact me and I will edit the results.php file for you. I think the content needs to be like this:

    if ( $query->have_posts() )
    {
    	?>
    	
    	<div class="ngo-list">	
    		<div class="table">
    				
                <table>
                    <tr>
    					<th>Name</th>
    					<th>Category </th>
    					<th>Website </th>
    					<th>Learn More </th>
    				</tr>
    	
    	<?php
    	while ($query->have_posts())
    	{
    		$query->the_post();
    		
    		?>
                    <tr>
    					<td><h5 class=""><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5></td>
    					<td><?php $term = get_field('ngo_category'); echo get_term($term)->name; ?></td>
    					<td><a href="<?php the_field('website'); ?>"><?php the_field('website'); ?></a></td>
    					<td><a href="<?php the_permalink(); ?>">View Details</a></td>
    				</tr>
    		<?php
    	}
    	echo paginate_links();
    	
    } ?>
                </table>
    					
            </div>
    	</div>	
    
    ?>
    #220443

    Anonymous
    Inactive

    Is tere a way to add my own Query sorting into the functions or results.php?

    #220227

    Anonymous
    Inactive

    I figured some things out here. Sorry for the pre-mature support request. I figured out that the problem wasn’t with my results.php code, but with the plug-in I was using to regenerate the image sizes. I got a new one and now the page is looking great with some css additions.

    #220104

    In reply to: Show Excerpt


    Trevor
    Participant

    Unless you have edited the results.php file, those are the excerpts. The length of the excerpt is defined by your theme, and must be quite long as that is much longer than usual.

    If you write your own excerpts, they will be used instead. The post editor should have a meta field to allow you to write custom excerpts. If you cannot see that field, open the Page Options (at the top of the page towards the right, under the admin bar) and enable them.

    #219973

    Anonymous
    Inactive

    Hi Trevor,

    Thanks for the prompt reply, I’ve amended my results.php file as per your suggestion on that other post but I think I’ve done something wrong as no results show now.

    This is my code:

    if ( $query->have_posts() )
    {
    	?>
          
    	<?php
    
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(233)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
         
            
    		?>
    	
    	  Results code here.
            
    		<?php} 
    	}
    
    ?>

    Any ideas where I’m going wrong with this?

    Thanks,

    James

    #219842

    Trevor
    Participant

    You are filtering using the envira-tag taxonomy. This is attached to Media posts only, so can you restrict the form to searching just the Media post type:

    https://www.screencast.com/t/f4myLKQtEp

    Then, in the child theme folder, in the search-filter sub-folder, can you copy the results.php file and name it 727.php?

    I will then need to write some custom code for you.

    #219414

    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

    You need to remove the lines::

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

    In reply to: Customizing Results


    Trevor
    Participant

    Here is the Codex for the_post_thumbnail:

    https://developer.wordpress.org/reference/functions/the_post_thumbnail/

    You need to change "small" to "medium"

    In the standard results.php, see lines 56-62 (yours may now be different):

    <?php 
    if ( has_post_thumbnail() ) {
      echo '<p>';
      the_post_thumbnail("small");
      echo '</p>';
    }
    ?>

    They need the link adding (with an alt to show the caption as a title), like this:

    <?php
    if ( has_post_thumbnail() ) { ?>
      <a alt="<?php esc_html(get_the_post_thumbnail_caption());?>" href="<?php the_permalink(); ?>"><?php the_post_thumbnail("medium");?></a>
    <?php	} ?>

    I *think* that is right. I do not think that esc_html(get_the_post_thumbnail_caption()); needs to be used with echo.

    You can use the same to put the caption on the page, like this:

    <h3 class="image-caption"><?php esc_html(get_the_post_thumbnail_caption());?></h3>

    and to get the description, I think some thing like this:

    <div class="image-description>
    <?php echo get_post(get_post_thumbnail_id())->post_excerpt;?>
    </div>

    You might need paragraph tags around the actual description, inside the div, like this:

    <div class="image-description><p>
    <?php echo get_post(get_post_thumbnail_id())->post_excerpt;?>
    </p></div>

    Let me know if that helps, or doesn’t work?

    #219117

    Trevor
    Participant

    If you need to modify our results.php template the guide is here:

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

    If you need to output the value of an ACF field, and give it a label, the code shown in this post might help:

    https://support.searchandfilter.com/forums/topic/output-acf-post-object-fields-in-results/#post-102009

    You may find other posts with snippets with this forum search:

    https://support.searchandfilter.com/forums/search/results.php+acf+get_field/

Viewing 10 results - 271 through 280 (of 1,224 total)