In my wordpress site, when i use the search it searches all the fields of the post.
I am looking for a way to define which fields it will look for from the default search of wordpress.
there are many manuals on creating your own custom search, but i am looking to make changes from dashboard or from search.php
any suggestions?
Here is the example :
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value="Enter keywords ..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;"/><br />
<select name="post_type">
<option value="">Choose Category:</option>
<option value="">All Categories</option>
<option value="post_type_a">Post Type A</option>
<option value="post_type_b">Post Type B</option>
<option value="post_type_c">Post Type C</option>
</select><br />
<input type="submit" id="searchsubmit" value="Search Help" />
</form>
If you dont want to show the custom post types in drop down you can assign the values in hiden fields also, something like below.
<input type="hidden" name="post_type[]" value="post_type_one" />
<input type="hidden" name="post_type[]" value="post_type_two" />
<input type="hidden" name="post_type[]" value="post_type_three" />
Related
I am using the code below but am not sure how to add in two separate search forms that search for products ONLY in the parent category. Either product_parent_cat_floral or product_parent_cat_rentals
<?php
$classes = get_body_class();
if (in_array('product_parent_cat_rentals',$classes)) {
?>
//rentals search form would go here
<?php } else { ?>
//flowers search form would go here
<?php } ?>
Can I edit this search form to somehow make it only search for products within the appropiate parent class?
<form role="search" method="get" id="searchform" action="http://botanicaevents.com/rentals/">
<div>
<label class="screen-reader-text" for="s">Search for:</label>
<input type="text" value="" name="s" id="s" placeholder="Search for products" />
<input type="submit" id="searchsubmit" value="Search" />
<input type="hidden" name="post_type" value="product" />
</div>
</form>
I think you can simply use:
<input type="hidden" name="product_cat" value="rentals" />
so your search query becomes:
?s=some+search+string&post_type=product&product_cat=rentals
to additionally restrict the search within the rentals product category.
I am creating a simple WordPress website, similar to this one: http://viewsyoutubes.com/
I need a form inserted, that when completed, will send the visitor to the PayPal payment page (so when the form is submitted, it redirects the visitor to the payment page URL).
However, I don't know how to make it so that depending on the option they have chosen, it sends them to a different payment page (there are different prices for different products - so when a product is selected, it needs to redirect the visitor to the corresponding payment page). It needs to be something like this:
http://viewsyoutubes.com/buy-youtube-views/
When a different package is selected, it sends you to a different payment page.
This is the site at the moment, as you can see there are 20 options in the drop down list, and i need the submit URL to change corresponding to the item that was chosen.
Thanks.
medialads.tk/youtube-views-likes/
You mean something like this?
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="Your#email.com">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="item_name" value="Shopping Cart">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHosted">
<input type="hidden" name="on0" value="Sizes"><select name="os0">
<option value="Small">Small $5.00 USD</option>
<option value="Med">Med $7.00 USD</option>
<option value="Larg">Larg $10.00 USD</option>
<option value="Super Size">Super Size $15.00 USD</option>
</select>
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="option_select0" value="Small">
<input type="hidden" name="option_amount0" value="5.00">
<input type="hidden" name="option_select1" value="Med">
<input type="hidden" name="option_amount1" value="7.00">
<input type="hidden" name="option_select2" value="Larg">
<input type="hidden" name="option_amount2" value="10.00">
<input type="hidden" name="option_select3" value="Super Size">
<input type="hidden" name="option_amount3" value="15.00">
<input type="hidden" name="option_index" value="0">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
I am using wordpress 3.3.1 with twentyten theme,
i have created a plugin to create a custom form,
i have successfully installed this in wordpress,
my plugin file code is as follows
<?php
function guest_event_form()
{
if(isset($_POST['submit']) and $_POST['action']=='new registration')
{
global $wpdb;
$wpdb->query("Insert Query...");
}
else
{
?>
<form method="POST" action="" name="guest_registration" enctype="multipart/form-data">
<input type="text" id="name" name="name" value="">
<input type="submit" name="submit" value="Register Me Now"/>
<input type="hidden" name="action" value="new registration" />
</form>
<?php
}
}
add_shortcode( 'guest_event_form', 'guest_event_form' );
?>
whenever i am submitting this form, i returns to same page with search results,
so i guess the problem whenever i submit this form, wordpress takes this submit action as a search action, and it starts search
how do i overcome this problem??
The Problem is because of following form element's id
<input type="text" id="name" name="name" value="">
name is one of the wordpress internal variable
Change it like this:
<input type="text" id="customername" name="customername" value="">
I need to incorporate a "Search" feature within my WordPress CMS site that I am currently developing and was hoping to attach this feature/plugin to the following piece of code and unsure how to do this in WordPress, i.e.:
<div id="search_box">
<form method="get" action="/search" id="form">
<input name="white_box" type="text" class="search" value="Search site" size="19" maxlength="80" id="white_box" onfocus="if (this.value=='Search site') this.value = ''"/>
<input name="submit" type="image" class="submit" value="submit" src="images/search_btn.jpg" />
</form>
</div>
I basically want to incorporate a "Search" feature on my site.
#Tonsils you may use any of below ready-to-use WordPress plugins depends on your requirement...
Use Relevanssi Plugin for Multilingual Support
http://wordpress.org/extend/plugins/relevanssi/
Use WPSearch for well behave custom Search
http://wordpress.org/extend/plugins/wpsearch/
Use Search-Everything for all type of Content Search
http://wordpress.org/extend/plugins/search-everything/
This a very basic WordPress search form. See the difference in the form action URL?
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<input type="text" size="14" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" class="s" />
<input type="submit" id="searchsubmit" value="<?php _e('GO'); ?>" />
</form>
I ran into a strange problem with checkbox groups. I am trying to get the values from a group of checkboxes, but I have to hit the submit button twice for it to get the values... I have no idea why. I also use a dropdown box on the same form and I only need to hit the button once to get its value.
my asp code to write it to page
Dim selectFormValue
selectFormValue = Replace(Request.Form("selectTest"), """", "")
Response.write Request.Form("checkGroup")
here is the html being generated
<form method="post" name="formTest">
<select name="selectTest">
<option value='123"' selected="">Option 1</option>
<option value='124"' selected="">Option 2</option>
<option value='125"' selected="">Option 3</option>
</select>
<input type="checkbox" name="checkGroup" value="1" CHECKED />
<input type="checkbox" name="checkGroup" value="2" CHECKED />
<input type="checkbox" name="checkGroup" value="3" CHECKED />
<input type="checkbox" name="checkGroup" value="4" CHECKED />
<input type="submit" name="submit" value="Update" />
</form>
Thanks!
One thing i note is, that you don't specify an action in your form.