We are going to
- register a `faq` Custom Post Type (CPT)
- register a `faq_category` custom taxonomy attached to the faq CPT
- enter the question as title and answer as the content for the FAQ entries
- load jQuery Collapse for the expand-collapse using My Custom Functionality plugin
In the PHP code, we shall retrieve the terms of the
taxonomy, loop through them and write a custom WP Query to pull all
entries that belong to that taxonomy and output them in a format suitable for jQuery Collapse.
Install and activate Custom Post Type UI plugin.
Go to CPT UI > Add/Edit Post Types and add the FAQ post type.
Go to Add/Edit Taxonomies and add the FAQ Category taxonomy.
Attach it to FAQs.
In the Settings section, set Hierarchical to True so it behaves like categories and not tags.
Go to FAQs > Add New and add your FAQ entries. Select the appropriate FAQ category and publish.
Install and activate My Custom Functionality plugin.
Connect to your hosting account using a FTP client and navigate to site's wp-content/plugins/my-custom-functionality-master.
Upload jquery.collapse.js to the plugin's
and replace the content of
This is a premium members-only content.
To view the rest of the content, please sign up for membership ($47/month or $499 one-time).
Already a member? Log in below or here.