• Is there a way to create meta boxes on the side of theme_options pages? I’m not sure what the show_on_post_type($type) attribute is supposed to be. Thank you.

    Container::make('post_meta', 'Custom Data')
        ->show_on_post_type('post') // I tried various options
        ->set_context('side')
        ->add_fields(array(
            Field::make('text', '_crb_meta_test')
        )
    );
Viewing 1 replies (of 1 total)
  • Plugin Author htmlBurger

    (@htmlburger)

    > Is there a way to create meta boxes on the side of theme_options pages?

    Currently, set_context() is only supported for the post_meta container (as WordPress’ post edit screen is the only screen which defines display contexts for meta boxes).

    > I’m not sure what the show_on_post_type($type) attribute is supposed to be.

    show_on_post_type($type) limits the visibility of a post_meta container to one or more post types. For example, show_on_post_type('post') will only add the container to posts but not to pages or other custom post types that may be defined.

    PS:

    Looking at your code you are creating a post_meta container, not a theme_options one. You can read more on the different types of containers here: https://carbonfields.net/docs/containers-usage/

Viewing 1 replies (of 1 total)
  • The topic ‘Post Meta on Options Pages?’ is closed to new replies.