Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #312738

    Hello,

    Is it possible to display search reasults in grid 3 columns with pagination ?

    I’ve seen a topic where is asking this. This is the answer:

    1) Insert following code into the quick css field:
    .template-search .post-entry {
    clear: none !important;
    }

    2) In search.php replace:
    if(!empty($_GET[‘s’]))
    {
    echo “<h4 class=’extra-mini-title widgettitle’>{$results}</h4>”;

    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-search.php and that will be used instead.
    */
    $more = 0;
    get_template_part( ‘includes/loop’, ‘search’ );

    }

    with:

    if(!empty($_GET[‘s’]))
    {
    echo “<h4 class=’extra-mini-title widgettitle’>{$results}</h4>”;

    global $posts;
    $post_ids = array();
    foreach($posts as $post) $post_ids[] = $post->ID;

    $atts = array(
    ‘type’ => ‘grid’,
    ‘items’ => get_option(‘posts_per_page’),
    ‘columns’ => 2,
    ‘class’ => ‘ (Purchase code hidden if logged out) ‘,
    ‘paginate’ => ‘yes’,
    ‘use_main_query_pagination’ => ‘yes’,
    ‘custom_query’ => array( ‘post__in’=>$post_ids, ‘post_type’=>get_post_types() )
    );

    $blog = new avia_post_slider($atts);
    $blog->query_entries();
    echo “<div class=’entry-content’>”.$blog->html().”</div>”;
    }

    This works all fine but there is no pagination. Is there a way to get the pagination here? =)

    Kind regards,

    Pieter L.

    #313682

    Hi Pieter!

    Pagination will appear when number of the posts being shown exceed the “Blog pages show at most” setting (Settings > Reading).

    Best regards,
    Josue

    #1137238

    Hi,

    How to add a custom result when there is no match.
    I mean if I search for DOG and there is no DOG post or image on the website, what and where can I add to have for example a custom image or link to appear (let’s say a referral sponsored link).
    Thanks

    Olivier

    #1137863

    Hi coumoliv,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Victoria

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

You must be logged in to reply to this topic.