I want to create a mechanism that displays a search box on a fixed page in Wordpress and displays the search results (table) below the search box when a search is made in the search box.

Is it possible to search a database with PHP etc. on a fixed page in Wordpress? →

Enter the function shortcode on the fixed page of Wordpress, PHP in function? Search database → Do you write a program to display

Please tell me which one is better.

I would be pleased if you could write a sample of how to write


Thank you very much.

When a search is performed in the search box on page 1, search results (in tabular form) are displayed below the search box on page 1.
It is a form.

A database of click beetles, and when a search is made using scientific names or Japanese names of click beetles, the corresponding click beetles are displayed.

  • Answer # 1

    The plugin that puts PHP in posts is heavy, scary and not recommended

    Short code if you have two choices with short code

    If you have two choices: write directly on a fixed page template or use short code
    It depends on the purpose

    If the search form is only used on that page
    It seems more maintainable to write directly on the template
    If there is something that you want to display on other pages
    It ’s better to use short codes

    I wonder if the next option is ajax or not
    Wordpress is a bit cumbersome to receive user input for non-ajax users

Related articles