tukutoi / tukutoi-search-and-filter Goto Github PK
View Code? Open in Web Editor NEWSearches, Filters and Custom Loops for WordPress Posts, Terms and Users.
License: GNU General Public License v2.0
Searches, Filters and Custom Loops for WordPress Posts, Terms and Users.
License: GNU General Public License v2.0
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.
It may register ShortCodes, but only add them to the GUI of TukuToi ShortCodes. If used alone, this plugin will not have a GUI.
Those search inputs are currently hardcoded options
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.
Those are currently just place holding.
Each type of search input needs its own form.
These are:
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.
In uninstall.php we are checking for a wrong slug with prefix tkt
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.