Skip to content

Using CMB to create an Admin Theme Options Page

Justin Sternberg edited this page Aug 17, 2017 · 31 revisions

This snippet has been moved to the CMB2 Snippet Library.

Remember to replace instances of myprefix and Myprefix with something unique to your code.

Retrieving saved data from the options page

Use the myprefix_get_option function included in the above snippets (obviously changing the prefix):

$field_value = myprefix_get_option( 'field_id' );

Documentation:

  1. Home

  2. Installation
    Installation instructions for various environments

  3. Basic Usage
    Get up and running

  4. Advanced Usage
    Not for the faint of heart

  5. Field Types
    Breakdown of field types

  6. Examples
    Examples for registering fields

  7. Field Parameters
    Breakdown of common field parameters

  8. Display Options
    Limit display of boxes

  9. Box Properties
    Breakdown of box properties

  10. Troubleshooting
    Common issues & how to deal with them

  11. Notable Changes in CMB2 (from original CMB)
    CMB2 — a complete re-write

  12. Tips & Tricks
    10x your CMB2 skills

  13. REST API
    CMB2 data through WordPress REST API

  14. Javascript API
    Work with CMB2 JS events & hooks

Advanced tutorials:

External Resources:

Clone this wiki locally