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).
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).
Share Improve this question asked Apr 18, 2020 at 22:49 lapuritalapurita 1011 Answer
Reset to default 1You can limit a search to a particular post-type quite easily: https://www.wpbeginner/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/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/reference/functions/register_post_type/