Support Forums

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro integration with custom template

Viewing 10 posts - 1 through 10 (of 10 total)
  • Ahmed Abouelenin
    #246672

    Hi,

    I am trying to make your plugin works with my custom theme/template. Could you please give me detailed instructions including settings and where I should paste your code suggestions because I read other suggestions and I could not apply what is suggested in them.

    I am using EDD plugin but with a custom theme/search.
    The search in the theme I am using is working as follows:
    There is a template for homepage where the search bar appears and the code inside it is below “code 1”>
    When I hit the search button, the browser is directed to the following link:
    https://home_url/?s=searchTerm&post_type=download

    Then I believe search.php is called. The code inside search.php is below as “code 2”.

    Thanks,
    Ahmed

    Code 1 in template home page

                <div class="search_EDD">
    
                    <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
    
                    <?php $searchresults = get_search_query(); ?>
                    <?php if ($searchresults != ('')){ ?>
                    <input type="text" placeholder="<?php _e( 'Search here...', 'searchTerm' ); ?>" value="<?php echo $searchresults; ?>" name="s" id="s" />
                    <?php } else { ?>
    
                    <input type="text" value="" name="s" id="s" placeholder="<?php _e( 'Search codes ahmed2...', 'searchTerm' ); ?>" />
    
                    <?php } ?>
                    <input type="hidden" name="post_type" value="download" />
                    <input type="submit" id="searchsubmit" value="<?php _e( 'Search', 'searchTerm' ); ?>" />
    
    				</form>
                    
                    <div class="clear"></div>
                    
                </div>

    code 2 in search.php

     <h1 class="title"><?php _e( 'Results For ', 'squarecode' ); ?>"<?php echo get_search_query(); ?>"</h1>
    
                    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
    
                    <?php if ( get_post_type() == 'page' ) { ?>
    ....
    <?php } elseif ( get_post_type() == 'download' ) { ?>
    // code that show the results in the way I want to see
    Ahmed Abouelenin
    #246687

    Some clarification of what I would like to achieve:
    I would like to keep using the same search bar I am using in the homepage from the theme and when I hit the search button the results are shown as before using the theme template but adding to it your very nice filters.

    I managed to implement the first part of the task, which is using the theme search bar in the homepage to call “search & filter” form. I manage doing this by changing “code 1” shown above to code 1 modified below where “page_id = 17690” is the page that includes the short codes of the “search & filter” form and I choose “Using a short code” in the Display Results setting.

    But now I need to implement the second part which is showing the results as the theme was showing before and keep showing the filters I added in the “search & filter” form. Could you help me in this.

    Thanks,
    Ahmed

    Code 1 modified in template homepage

    <div class="search_EDD">
    
                    <form role="search" method="get" id="search_AH" action="<?php echo home_url( '/' ); ?>">
    
                        <input type="hidden" name="page_id" value="17690" />
    			        <input type="text" name="_sf_s" id="_sf_s" />
                        <input type="submit" id="searchsubmit" value="Search" />
    					
    				</form>
                    
                    <div class="clear"></div>
                    
      </div>
    Trevor Moderator
    #246763

    Are you able to send me a live link/URL to your search page so I can take a look? What word should I search for to test this?

    Ahmed Abouelenin
    #246780
    This reply has been marked as private.
    Trevor Moderator
    #247109
    This reply has been marked as private.
    Ahmed Abouelenin
    #247273
    This reply has been marked as private.
    Ahmed Abouelenin
    #247275
    This reply has been marked as private.
    Trevor Moderator
    #247461

    Is the actual content (the words) correct? I can see that the original shows only the year, but that can be fixed to make our template show just the year as well. Both have Title, Excerpt and Date (year).

    If so, very little change is needed to our template.

    The guide to customising is here:

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

    In the main, it may be a case of simply adding the classes and HTML containers used by the original.

    Ahmed Abouelenin
    #247769

    Thanks so much Trevor!
    It is working now!

    Trevor Moderator
    #247789

    Thanks for letting me know. I will close this thread for now.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘integration with custom template’ is closed to new replies.