I would like to get this URL by selecting it by check box
my domain/category/slugA+slugB
Currently, I have the following code, but the URL I got is like this (%2b stands for +).
my domain/?category=SlugA%2bSlugB
Code provided
<form class="cat-search" action="<?php bloginfo('url');?>">
<input type="checkbox" value="SlugA" id="cat0" class="cats2"/><label for="cat0">Category1</label>
<input type="checkbox" value="SlugB" id="cat1" class="cats2"/><label for="cat1">Category2</label>
<input type="checkbox" value="SlugC" id="cat2" class="cats2"/><label for="cat2">Category3</label>
<input type="checkbox" value="SlugD" id="cat3" class="cats2"/><label for="cat3">Category4</label>
<input type="checkbox" value="SlugE" id="cat4" class="cats2"/><label for="cat4">Category5</label>
<input type="hidden" id="cat2" name="category"/>
<input type="submit" class="cat-search" value="search"/>
</form>
$(function(){
$('body').on('click', '.cats2', function(){
varcats=$('.cats2:checked') .map(function(){
return this.value;
}).get().join("+");
$('#cat2') .val(cats);
});
});
In the first place, I don't know if I can get the URL I want using the check box.
If the question mark is always included and it cannot be in the form of the URL you are looking for in the first place, I can give up, but if anyone knows, please take care of it.
wordpress
I solved myself.
You can now use the search plug-in to display what you intended.
Thank you for editing.
The plug-in you used is a paid version of Search and Filter.
918 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
578 Understanding How to Configure Google API Key
621 Uncaught (inpromise) Error on Electron: An object could not be cloned
582 PHP ssh2_scp_send fails to send files as intended
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.