If you aren’t already familiar, CMB2 is a metabox, custom fields, and forms library for WordPress. And well…as Justin pointed out, what is it good for? Absolutely everything! With seemingly endless options, it can sometimes be difficult to decide on how to implement these types of customizations. Well, what if you have a lot of questions? And just as many answers? Look no further. Let’s create a ‘Frequently Asked Questions’ section. For the purposes of this, I installed CMB2 within my theme rather than within a separate plugin. Important to note: depending on the purpose of your data/if it is theme dependent, you might want it to stick around if your theme changes someday so the plugin route might be preferable! First off, follow the directions to set up the ideal file structure for CMB2 within your theme. Second, we need to define our metabox and the particular customizations we would like. In our case, we’re going to be creating a metabox that has groupings within it. Those groupings will be our question and answer pairings. add_action( 'cmb2_admin_init', 'wds_faq_metaboxes' ); /** * Define the metabox and field configurations. */ function wds_faq_metaboxes() { /** *
Share This