I have to create a data range search for my site with two input (start-date, end-date). I'm using Timber and i have no idea how to do it.

Here's my code in search controller. How can I implement this feature?

 * Search results page

$templates = array( 'context-search.twig', 'context-archive.twig', 'context-index.twig' );

$context = Timber::get_context();
$search_query = get_search_query();

if($search_query != ''){
    $search_placeholder = $search_query;
    $context['title'] = $search_query;
    $search_placeholder = 'Type something and press enter';
    $context['title'] = 'Search';

$categories = get_terms(
        'parent' => 0,
        'exclude'=> 1

$context['search_placeholder'] = $search_placeholder;
$context['categories'] = $categories;
$context['pagination'] = Timber::get_pagination();
$context['posts'] = new Timber\PostQuery();

Timber::render( $templates, $context );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.