Hello, I’m struggling with search block and search results page, in TwentyTwentyfour theme.
Personal need: blog is based on two sections, each one has its posts categorized as “real world” and “fake world”. No particular customization in types and taxonomies, “it’s just “real world” and “fake world” are two categories with their own customized templates – fakepost and realpost, associated to their own template parts (headers and footers, meta and sidebars).
For the search block I changed its behaviour manually by code view, in each header, as follows:
<!-- wp:search {"showLabel":false,"buttonPosition":"button-only","buttonUseIcon":true,"query":{"cat":"xxx"}} /-->
“xxx” stands for the numeric ID corresponding to the desired category, let’s say “10” for real, “11” for fake.
This way, when I search for a keyword, it returns [siteurl]/?s=[keyword]&cat=[number] – this is what I wanted it to do.
But the issue comes in the results page!
Is there a way to tell the search form’s “get” method, ‘if search comes from /real go to result-real, if it comes from /fake, point to fake-results’?”
I googled and found that for customizing search template you should create a searchform.php file but, besides not working (I uploaded it into /templates/ folder), I don’t find the right instructions to build the condition to influence the form submission. And I don’t feel like changing the /wp-includes/general-template.
Thanks in advance for possible help
]]>single.php:
<aside id="sidebar">
? ? ? ? <?php dynamic_sidebar('main_sidebar'); ?>
? ? ? </aside>
searchform.php:
<form method="GET" action="<?php echo home_url(); ?>">
<input type="search" name="s" placeholder="Search Here..." value="<?php echo get_search_query(); ?>">
<input type="submit" id="search-btn" value="">
</form>
functions.php
function fcc_widgets(){
register_sidebar([
'name' => 'Main Sidebar',
'id' => 'main_sidebar',
'before_title' => '<h3>',
'after_title' => '</h3>',
]);
}
add_action('widgets_init', 'fcc_widgets');
]]>Hi,
I use the plugin popups for Divi and I have an issue with it.
I add my search form in the popup. In the searchform I use select2/multiselect, but within the popup this function doesn't work
Is there a silution for this?
https://www.hulpbijhb.nl/resultaten-pagina-dagbesteding this is the link to my website. If you use the filter button the popup appears.
Kind regards,
Joyce
]]>I want to set up a SearchForm
on:
if ( is_archive() || is_category() || is_search())
between header and container, or as first item in container before all content.
The hierarchy would be:
<header class=”masthead …
<header class=”landmark …
SearchForm
<div class=”container …`
or
<div class=”container …`
– SearchForm –
Content of container
—
searchform.php template exist
Thanks in advance !
]]>I’m using BA plugin for my vacation rental properties website. I have added the BA search form on home page where customers can search their desired properties by choosing the location and dates. I wanted to add a custom field called ‘date to’ field in the form as there is only ‘date from’ field. How can I set the calender date range?
]]>The value of an ARIA ID must be unique to prevent other instances from being overlooked by assistive technologies. Learn more.
Failing Elements
input#s
Clicking on input#s, it looks like it’s referring to:
.searchform input#s {
background-color: #fff;
border-radius: 3px 0 0 3px;
border-right-width: 0;
padding: 16px 18px;
min-width: 0;
width: 100%;
}
in ple.css line 384
Any idea?
]]>I have a jobs custom post type that is currently using the wp_dropdown_categories() function within a WP search form so people will be able to filter jobs by salary level and job type.
I would like to use input element checkboxes instead, so the user can select multiple taxonomy terms.
From what I gather this is best done with wp_terms_checklist(), however I cannot seem to get it work. The information in the developer docs seems sparse to say the least.
If I have a search form and wish to add two taxonomy terms lists for people to select items from how would I go about doing this?
Basically the form has a keyword search box then two taxonomy lists to choose from, where users either search by a combination of keywords and taxonomies or just keywords etc
Below is some pseudo code showing what I would like to achieve.
<form method="get" action="<?php echo esc_url(site_url('/')); ?>">
<label id="searchlabel" for="s">Search</label>
<input id="s" name="s" type="search">
<input type="hidden" name="post_type" value="jobs" />
// add 1st instance of wp_terms_checklist() // job type taxonomy
// add 2nd instance of wp_terms_checklist() // salary level taxonomy
<input class="td search-jobs-button" type="submit" value="Search Jobs">
</form>
]]>