Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 841 through 850 (of 1,224 total)
  • Author
    Search Results
  • #70771

    Ross
    Keymaster

    Hey Rai sorry for the delay.

    If you take a look at the code from our results.php:

    wp_pagenavi( array( 'query' => $query ) );

    You see we are passing in the query, this is necessary so wp_pagenavi knows that it working with a specific query rather than the global $WP_Query.

    I had a quick look at the plugin you were using wp_bootstrap_pagination

    https://github.com/talentedaamer/Bootstrap-wordpress-pagination/blob/master/wp_bootstrap_pagination.php

    I see it is possible to pass a custom_query argument to it.. something like:

    $args = (
        'custom_query' => $query
    );
    wp_bootstrap_pagination($args);

    I’m hoping this will work, however I’m not too familiar with that plugin, it might be best to ask them how to use their plugin with a custom query…

    I do see one potential point of problem though, and that is this line (26):

    $page = intval( get_query_var( 'paged' ) );

    That plugin is setting the current page variable with get_query_var which uses the global query, which in this case will cause errors.

    EDIT: In fact I’ve just submitted an issue over there recommended the code change:
    https://github.com/talentedaamer/Bootstrap-wordpress-pagination/issues/10

    Hope that helps!

    #70756

    Anonymous
    Inactive

    Thanks for all the help Trevor, sorry to come back to you so quick but the code added in the results.php has just come up with ‘Array’ rather than the star rating?

    while ($query->have_posts())
    {
    $query->the_post();

    ?>
    <div>
    <h2>“><?php the_title(); ?></h2>

    <p><br /><?php the_excerpt(); ?></p>
    <?php
    if ( has_post_thumbnail() ) {
    echo ‘<p>’;
    the_post_thumbnail(“small”);
    echo ‘</p>’;
    }
    ?>
    <p><?php echo get_post_meta( get_the_ID(), ‘ratings_average’ ); ?></p>
    <p></p>
    <p><small></small></p>

    </div>

    <hr />
    <?php

    #70656

    Trevor
    Participant

    In this post, I asked if you had followed the customization guide?

    If you did, then the active copy of the results.php file is in your theme folder, not in our plugin folder.

    #70490

    Trevor
    Participant

    The HTML element that the results are wrapped in depends on the Display results method chosen. If using our Shortcode method, you can edit the example results.php file (see here for how), but my default it has a containing tag like this (depending on the form ID):

    <div class="search-filter-results" id="search-filter-results-255">

    I have re-read the thread. I need to get a better handle on what you want to do and what the page would look like. Have you sketched out the idea in visual form? Maybe you could upload an image to a file sharing site and give me a link?

    #70334

    Trevor
    Participant

    OK. The >> is made by your theme and needs to be switched off inside search and filter forms, with Custom CSS:

    .bSe .searchandfilter ul li::before {content: '' !important;}
    

    To put the search field and button next to each other, this:

    .searchandfilter .sf-field-search {
      display: inline-block;
      padding-left: 0 !important;
      margin-right: 20px;
    }
    .searchandfilter .sf-field-submit {
      display: inline-block;
      padding-left: 0 !important;
    }

    For the second point, to hide results until a search has been made, I need to know you have placed a copy of the results.php file in your theme or child theme folder, as here:

    https://www.designsandcode.com/documentation/search-filter-pro/search-results/using-a-shortcode/#Customising_the_Results

    Assuming that you have, edit that file and replace the content with this:

    <?php
    /**
     * Search & Filter Pro 
     *
     * Sample Results Template
     * 
     * @package   Search_Filter
     * @author    Ross Morsali
     * @link      http://www.designsandcode.com/
     * @copyright 2015 Designs & Code
     * 
     * 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
     *
     */
    
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(255)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
    	
    	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";
    }
    }
    ?>

    That should work, I hope.

    For #3. It would be better to use your theme’s own styling, and to do this I would need to see a more normal results page in your theme that looks OK to you, then we can borrow their styling.

    #69961

    Trevor
    Participant

    The code on this post:

    https://support.searchandfilter.com/forums/topic/how-to-not-show-results-in-first-search-translate-older-newer-posts-2/#post-68157

    Is correct (I have edited it to work. If you use a decent code editor with a dual pane and put the code in that post in one php file and open the standard results.php, you will see the differences, I hope. BTW, I use the free brackets.io editor (from Adobe).

    #69814

    Anonymous
    Inactive

    I have been successful at modifying the results.php file.
    Is there something similar that can be modified for the search code? I obviously don’t want to modify the code within your plugin.
    Thanks,
    Bill

    #69336

    Anonymous
    Inactive

    Hi Ross,

    Totally sorry!, my fault. I mix two things that are not related.

    Ok, so what I want to achieve is to paginate the results, like: page 1, 2, 3, 4 and like that when pagination is need it. So I find on the results.php this code that works with wp_pagenavi plugin but I´m using

    <?php if ( function_exists('wp_bootstrap_pagination') )
      wp_bootstrap_pagination(); ?>

    Any way to make it work?, why it works just with wp_pagenavi?.

    Thanks.

    #69321

    Trevor
    Participant

    Hi, the appearance of results depends on the Display Results Method chosen in the form setup. The Shortcode method will use the (customizable) results.php template file that is in the plugin template folder (you should put a copy in your theme folder in a sub-folder called search-filter).

    Depending on the HTML/JS used in the desired layout, this can be simple to do (for me).

    If you use any other results display method, it will use the theme templates to display the results. The Archive method (can) most closely mimic the normal theme search page.

    #69114

    Anonymous
    Inactive

    Hi!,

    I want to display the term of the search as title in the results.php.
    For example, if someone search for: “Chile”, then in the header of the results will say, “The results for Chile”.

    Any code to achieve this.

    Thanks.

Viewing 10 results - 841 through 850 (of 1,224 total)