how to search in wordpress from the database mysql -


i having website www.xyz.com in wordpress,i want implement search option in home page should in manner when user search state or thorough pin code should result, kindly let me know how same , codding .

i using coding is: find yoga class in city:
search, , want backend code can call function database, , implemented

from sounds of things, want enable search of yoga classes based on zip-code or state. can bit tricky, actually, can done.

custom post type

first of all, you'll want create custom post type called "yoga class" classes. separate category of posts special capabilities. each class can have "description" field, "location" field, "time" field, "instructor biography" field, etc. depends on information want provide each class.

here's great tutorial on creating , working custom post types: custom post types in wordpress.

custom taxonomy

to enable searching , sorting, you'll need categorize yoga classes in meaningful way. since wordpress 2.8 came out, we've supported custom taxonomies posts, pages, , custom post types. it's way divide content meaningful groups, making easier search , view content based on custom fields.

you'll need 2 custom taxonomies: state, , zip code.

here's great tutorial on creating , managing custom taxonomies: custom taxonomies in wordpress 2.8

custom search

your search box search through custom post type (yoga class) entries state or zip code taxonomy term matching search criteria. if search class in tennessee, search entries post_type=yoga_class , state=tennessee or zip-code=tennessee. if search class in zip code 90210, search entries post_type=yoga_class , state=90210 or zip-code=90210.

this far easiest way search entries based on zip codes. if want can search classes in nearby zip codes rather exact matches, recommend reading on a similar question on @ wordpress answers.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -