Forums Forums Search Search Results for 'results.php'

Viewing 10 results - 411 through 420 (of 1,224 total)
  • Author
    Search Results
  • #193405

    Trevor
    Participant

    Yes, like this:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(12204)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      echo '<div>Nothing to see here folks!</div>'; 
    } else {
      // your template archive code/loop OR results.php code here
    }
    #193108

    Anonymous
    Inactive

    Hi Trevor, thanks for the prompt reply, however that’s not the issue. Please look at my stackexchange thread which explains what I am trying to achieve:

    https://wordpress.stackexchange.com/questions/318675/template-loop-add-switch-case-php

    Also another question, doesn’t your results.php need to have wp_reset_postdata(); for best practices?

    #192299

    In reply to: Search results


    Anonymous
    Inactive

    I use results.php, this is my problem?

    #192295

    In reply to: Search results


    Trevor
    Participant

    When you originally made your results.php file, did you use the contents of the exemplar results.php file or the contents of the exemplar results-infinite-scroll.php scroll?

    The structure of the two exemplar files is different.

    #192288

    Anonymous
    Inactive

    HI,

    We have a custom post type called FAQ. That post type has a taxonomy called Faq Categories.

    At the moment we have a standard WordPress page set up with the shortcode & results shortcode from our form using ajax. This is working fine. We have styled our results.php file how we want.

    However, we also want to display the same form and results style on our custom taxonomy template but obviously only show results for the current tern. eg.

    faq_category/financial shows only the financial results with the a, using ajax, and our results.php styling / layout.

    Is it possible to have the form limit the results to just the current term and use Ajax?

    Thanks

    Adam

    #192253

    Anonymous
    Inactive

    Hi,
    So I’ve copied the results.php file to mytheme/search-filter/results.php and changed both instances of ‘Older Posts’ but it hasn’t changed. ie:
    <div class=”nav-previous”><?php next_posts_link( ‘More posts’, $query->max_num_pages ); ?></div>
    <div class=”nav-next”><?php previous_posts_link( ‘Previous posts’ ); ?></div>

    What else can I check?

    Thanks

    #192218

    In reply to: Search results


    Trevor
    Participant

    Ah, I can see what you have done now. It would need for part of the blog page template to be placed in the results.php file and for the blog template instead of calling the results shortcode, to call the content.

    I can write this for you if you want:

    In blog-page.php change lines 24-29:

    <div class="page-blog page-blog-title">Recent posts</div>
      <div class="blog-posts">
    
        <?php echo do_shortcode('[searchandfilter id="463" show="results"]');?>
      </div>
    </div>

    with:

    <?php the_content(); ?>
    

    Next, in the results.php file, find lines 68 and 69:

    </a></a>
    </div>

    I believe these have errors and should be just:

    </a>
    

    At the very end of the file is a blank line, after this:

    else  ?>
    
    <?php {
    	
    }
    ?>

    Here add two closing tags:

    </div>
    </div>

    Now find lines 25 and 26 (which are blank) and paste these lines:

    <?php global $searchandfilter;
    $sf_current_query = $searchandfilter->get(463)->current_query();
    if ((!$sf_current_query->is_filtered())&&($sf_current_query->get_search_term()=="")) {
      $page_title = "Recent Posts"; 
    } else {
      $page_title = "Search results for: " . $sf_current_query->get_search_term();
    }?>
    <div class="page-blog page-blog-title">Recent posts</div>
      <div class="blog-posts">

    I think that will do as you want. The title must be inside the results.php for it to be affected by if there are results.

    #192214

    In reply to: Search results


    Anonymous
    Inactive

    I repeat my problem again:

    I have filter as shortcode on page /blog/. I use SHORTCODE method to filter/display results on this page.
    I want to change title on BLOG page, not in results.php LOOP. NOT IN LOOP. Only one BLOG page title, which is “Recent posts” and marked <div class="page-blog page-blog-title">Recent posts</div>. It’s not in loop.

    #192200

    In reply to: Search results


    Trevor
    Participant

    When I looked at your site, you had two forms. One was using our shortcode method, and that is what is used on the page (not the template you mention). In your theme (or child theme) folder, you had a sub-folder called search-filter. In that was the results.php template.

    #192194

    In reply to: Search results


    Anonymous
    Inactive

    This is similar to what I need, but not at all.
    I have blog-page.php in my theme, and in line 24 i have:
    <div class="page-blog page-blog-title">Recent posts</div>
    I want chagne this, not in results.php loop.

    I tried to put your code in blog-page.php, but ajax do not working.

Viewing 10 results - 411 through 420 (of 1,224 total)