Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 211 through 220 (of 1,224 total)
  • Author
    Search Results
  • #233154

    Trevor
    Participant

    The plugin does not, at this time, use a translation file, so the admin interface is only in English, sorry. For the front end, you can set the titles/headings etc of the form fields as you wish. Only the Shortcode display results method uses a template file that comes with the plugin. All other methods rely on your theme template files. Do you need to translate the strings used in our template file, if you are using the Shortcode display results method?

    See this documentation page:

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

    In the customising section, you can create a custom results.php template within your theme folder, or make results templates for individual forms (using their ID numbers). If you are using more than one language, each language of the form has its own ID number, thus allowing you to make individual language templates that you can edit yourself. The strings are found in the templates.

    #233113

    Anonymous
    Inactive

    Yes you’re right! That worked, I didn’t know that I had to edit the results.php in theme editor and didn’t understand why it didn’t work to just fill out the fields in the search and filter Display Results tab.

    #232380

    Anonymous
    Inactive

    Hello

    I want to reset my query so i can target each post even/odd with :nth. But it doesn’t seem to work when i use this in the results.php file:
    <?php wp_reset_postdata(); ?>
    <?php wp_reset_query(); ?>

    Any suggestions to how i can separate each post section from each other?

    #231310

    Trevor
    Participant

    Note that, for infinite scroll, you need to use the contents of the infinite scroll template, not that of the standard results.php. The file in your child theme folder still needs to be named results.php.

    #231244

    Trevor
    Participant

    You would need to customise the results.php file to add HTML structure, classes and content. To start this, see this link:

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

    However, for a more ‘instant’ solution, you might use a page builder or grid plugin, such as shown here (the one shown is free):

    https://searchandfilter.com/documentation/3rd-party/post-grid/


    Trevor
    Participant

    I have looked at the file and indeed the structure of the HTMl is that of a non-infinite scroll results.php file.

    It will need to be modified/edited to be usuable for infinite scroll.

    If you look in the plugin folder, there is a templates sub folder with examples of normal pagination and infinite scroll, to help you re-code it.

    For me it might look like this instead?

     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      https://searchandfilter.com
     * @copyright 2018 Search & Filter
     *
     * Note: these templates are not full page templates, rather
     * just an encaspulation of the your results loop which should
     * be inserted in to other pages by using a shortcode - think
     * of it as a template part
     *
     * This template is an absolute base example showing you what
     * you can do, for more customisation see the WordPress docs
     * and using template tags -
     *
     * http://codex.wordpress.org/Template_Tags
     *
     */
     
    if ( $query->have_posts() )
    {
        ?>
         
        <!-- ***********************************************************************************************************
        products
        ************************************************************************************************************* -->
        <div class="found">Found <?php echo $query->found_posts; ?> Results<br /></div>
         
        <div class="search-filter-results-list products-list-area">
            <?php
            while ($query->have_posts())
            {
                $query->the_post();
                 
                ?>
     
                <div class="search-filter-result-item products-list-item w_addt_image">
                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
     
                        <!-- 1st image from gallery on hover -->
                        <?php $addt_image = get_field('nr_additional_images'); if( $addt_image ): ?>
                        <div class="products-list-item-img-wrap addt_image">
                            <img src="<?php echo $addt_image[0]["sizes"]["large"]; ?>">
                        </div>
                        <?php else: ?>
                        <div class="products-list-item-img-wrap addt_image">
                            <?php the_post_thumbnail(); ?>
                        </div>
                        <?php endif; ?>
     
                        <?php $product_thumb = get_the_post_thumbnail(''); if( !empty($product_thumb) ): ?>
                        <div class="products-list-item-img-wrap">
                            <?php the_post_thumbnail(); ?>
                        </div>
                        <?php else: ?>
                        <div class="products-list-item-img-wrap">
                            <img src="http://placehold.it/300x300/e5e5e5/ffffff?text=Image+Not+Available" alt="">
                        </div>
                        <?php endif; ?>
     
                    </a>
                    <div class="details">
                        <!-- <div class="product-material-and-collection"><?php the_field('nr_material'); ?> | <?php the_field('nr_collection'); ?></div> -->
                        <div class="product-material-and-collection">
                        <?php
                            $field1 = get_field_object('nr_material');
                            $materials = get_field('nr_material'); // array of selected values
                            $resultstr = array();
                            foreach ($materials as $material) {
                                $resultstr[] = $field1['choices'][ $material ];
                            }
                            echo implode(", ",$resultstr);
                        ?>
                         |
                        <?php
                            $field = get_field_object('nr_collection');
                            $value = $field['value'];
                            $label = $field['choices'][ $value ];
                        ?>
                        <?php echo $label; ?>
     
                            <?php the_favorites_button($post_id, $site_id); ?>
                        </div>
                        <div class="product-name">
                            <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                        </div>
                    </div>
                </div>
                 
                <?php
            }
            ?>
        </div>
         
        <?php
    }
    else
    {
    	?>
    	<div class='search-filter-results-list' data-search-filter-action='infinite-scroll-end'>
    		<span>End of Results</span>
    	</div>
    	<?php
    }
    ?>
    #230887

    Trevor
    Participant

    You would need to be using our Shortcode Display results method (as you are), and have followed the ‘guide to customising’:

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

    Once you have a copy of the results.php file in a search-filter sub-folder of your theme, you can edit that file, like this (leave the PHP comments at the top outside and before this code):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1605)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // the theme template PHP code here
    }
    #230834

    Anonymous
    Inactive

    “I can see what you are doing. You have on the page two archives which are S&F form Results shortcodes. The forms themselves are being used only to pre-filter, with no actual form.”

    > Correct

    You are using custom results.php files (numbered the same as the forms). If using the standard results.php template for both results, there is not an issue?

    > It works with the default listing.

    If form #780 uses the standard results.php, but form #781 uses the custom one, it works?

    > It does.

    If form #780 uses the custom results.php and form #781 uses the standard results.php, what happens then?

    > It does NOT work.

    I’m using the default loop “while ($query->have_posts())” and then using filters to remove some of the results with get_field. That’s why I’m not using any limist to the results (they list from 105 to 300 results).

    If both results are using a custom result.php, the second (781) is not even going into the “if ($query->have_posts())” loop.

    #230633

    Ross
    Keymaster

    Haha yeah I saw a few and deleted them.

    So, regarding the issue, I can’t see anything unusual from my side (in terms of your setup).

    Things I would try:

    1) use the default results.php and normal pagination – check if it works?
    2) if it does work, try our infinite scroll template and check again…

    From there we will know if its a template issue or something bigger.

    I would also try with 3 results on your other search forms, to see if they load all their results fine too.

    Let me know when you’ve tested that and what the results are, I’ll then dive in further if necessary.

    Thanks

    #230612

    In reply to: Image Alignment


    Ross
    Keymaster

    Hi Melissa

    While we don’t usually write custom layouts, I’ve gone ahead and put something together.

    What you will need to do is 2 things:

    1) Modify the results template
    a) Start by copying the results.php file into your theme folder (following instructions here – https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-results)
    b) Replace the contents of your new results.php, with the contents of this gist – https://gist.github.com/rmorse/70dfeb6f58f9685a2266d779244b75a8#file-sf-pro-results-template-example-php
    Note – keep the filename as results.php

    2) Add css to your theme
    Add this CSS to your theme:
    https://gist.github.com/rmorse/870914c28e93fb270965b9e0b933e0e4

    I hope that helps 🙂

Viewing 10 results - 211 through 220 (of 1,224 total)