0

I am creating an educational website and some of my pages are "subjects" like math, physics etc and I want them to be searchable. How do I do this? I thought that it would be easy if I just made a custom post type for the subjects, and then a search form that only searches for that particular custom post type (the subjects). The problem is that I'm unable to create custom post types that are like the PAGES post type. I'm only able to create "blog-like" custom post types if you know what I mean?

Basically this is what I want: A search form that ONLY shows the subjects as results. Do I need custom post types for that or is it possible to add a category named "subjects" to the pages in question and then search for the category "subjects" only? If I need custom post types, how do I create "page-like" custom post types (that are possible to design with elementor or the block editor).

1

You can limit a search to a particular post-type quite easily: https://www.wpbeginner.com/wp-tutorials/how-to-limit-search-results-for-specific-post-types-in-wordpress/

Or a nice simple way to limit a search to a particular category by adding a hidden field into the search form: https://www.wpexplorer.com/limit-wordpress-search/

In terms of post vs page for custom post types, you can find the differences on the documentation page for setting up custom post types. See “hierarchical” option. You’d probably want the page type (hierarchical) https://developer.wordpress.org/reference/functions/register_post_type/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.