Advanced search for custom post types – WortGepresst



STARTSEITE MULTIMEDIA WORTGEPRESST FAMILIENBANDE BOOKMARK PRIVACY


Advanced search for custom post types

Setting up custom search forms for custom post types can be tricky business. Here’s a quick & easy guide to make it happen in two steps.

Step 1: Edit the search form

In your WordPress theme, locate the template code used to create your regular search form. Add to it the following hidden input fields:

HTML

 

Step 2:

Next we want to display the search form that will allow users to search based on custom post type. Add the following code wherever it makes sense in your theme template file(s). For example,search.phporsidebar.php. Here is the custom codes to use:

HTML

 
And that’s all folks. Once implemented, this technique will enable users to search your site based on custom post type. The search form will display checkboxes for each custom type.

Font Resize
Contrast
Zur Werkzeugleiste springen