Giter Club home page Giter Club logo

tukutoi-search-and-filter's People

Contributors

smilebeda avatar

Watchers

 avatar  avatar

tukutoi-search-and-filter's Issues

Check AJAX Search/Pagination when no results found

When no results are found the AJAX ends in a 404 not found in the console, which stops further execution and thus pagination cannot be updated after a search.

This needs to be fixed, not sure yet how, but shouldn't be too hard, probably just a better error handling needed in the AJAX on error case.

Add Swiper.js for full Slider and Fancy Pagination Support

Perhaps as pagination, or separate ShortCode.

I have achieved great results with the current plugin already, but you can basically just load either all results, or a batch of, and then use Swiper to paginate. This is great but if you load 10K posts in a slider it would of course be cumbersome.

It would be great if we could use this as pagination also because they have cool effects.

As of now, this is how to use it with the plugin:
Enqueue stuff:

wp_enqueue_style('swiper', 'https://unpkg.com/swiper/swiper-bundle.min.css', array(), '6.8.2', 'screen');
wp_enqueue_script('swiper', 'https://unpkg.com/swiper/swiper-bundle.min.js', array(), '6.8.2', true);
wp_enqueue_script('your-swiper', plugin_dir_url( __FILE__ ) . 'js/tkt-search-and-filter-public.js', array('swiper'), false, true);

Then load a batch of posts with the plugin, for example like so:

<!-- some basic style -->
<style>body,html{position:relative;height:100%}body{background:#eee;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:14px;color:#000;margin:0;padding:0}.swiper-container{width:100%;height:100%}.swiper-slide{text-align:center;font-size:18px;background:#fff;display:-webkit-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center}.swiper-slide img{display:block;width:100%;height:100%;object-fit:cover}body{background:#000;color:#000}.swiper-container{width:100%;height:300px;margin-left:auto;margin-right:auto}.swiper-slide{background-size:cover;background-position:center}.mySwiper2{height:80%;width:100%}.mySwiper{height:20%;box-sizing:border-box;padding:10px 0}.mySwiper .swiper-slide{width:25%;height:100%;opacity:.4}.mySwiper .swiper-slide-thumb-active{opacity:1}.swiper-slide img{display:block;width:100%;height:100%;object-fit:cover}</style>

<!-- start the slider markup-->
<div style="--swiper-navigation-color: #fff; --swiper-pagination-color: #fff" class="swiper-container mySwiper2" >
  
  <!-- Load the full image on top of the thumbnails -->
  [tkt_scs_loop instance="slidermain" type="post" error="No Posts Found" pag_arg="slide" posts_per_page="-1" container="div" customclasses="swiper-wrapper"]
    <div class="swiper-slide"><img src="[tkt_scs_attachmentimage item='' url='' show='featured_image' width='' height='' size='full' icon='' filter='raw' sanitize='url_raw']"></div>
  [/tkt_scs_loop]
  <!-- Load the Swiper pagination markup -->
  <div class="swiper-button-next"></div>
  <div class="swiper-button-prev"></div>
</div>
<!-- load the thumbnails markup-->
<div thumbsSlider="" class="swiper-container mySwiper">
  <!-- Load the thumbnails images -->
  [tkt_scs_loop instance="slider" type="post" error="No Posts Found" pag_arg="slide" posts_per_page="-1" container="div" customclasses="swiper-wrapper"]
    <div class="swiper-slide"><img src="[tkt_scs_attachmentimage item='' url='' show='featured_image' width='' height='' size='thumbnail' icon='' filter='raw' sanitize='url_raw']"></div>
  [/tkt_scs_loop]
</div>

Then in your your-swiper JS initialise the SwiperJS:

(function( $ ) {
	'use strict';
	var swiper = new Swiper(".mySwiper", {
        spaceBetween: 10,
        slidesPerView: 4,
        freeMode: true,
        watchSlidesVisibility: true,
        watchSlidesProgress: true,
    });
    var swiper2 = new Swiper(".mySwiper2", {
        spaceBetween: 10,
        navigation: {
          	nextEl: ".swiper-button-next",
          	prevEl: ".swiper-button-prev",
        },
        thumbs: {
          	swiper: swiper,
        },
        autoplay: {
	   		delay: 2100,
	 	},
    });  
})( jQuery );

This loads a nice Swiper like seen in the movie below.

Screen.Recording.2021-08-17.at.16.51.32.mov

Work over the Search inputs form files (for GUI)

Those are currently just place holding.
Each type of search input needs its own form.

These are:

  • text search
  • select search
  • radio search
  • buttons (these can be both search inputs or submit/reset/button inputs)
  • checkboxes search

Add AJAX search

It should be possible to re-use most of the code, just swap the GET to POST and apply the required hooks, then craft the JS to handle the fancy part.
Perhaps a new method to handle the Query Args is required as right now we use GET and not POST data, but that shouldn't be a big deal.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.