Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Aug 26, 2020. It is now read-only.

Pressmodo/carbon-fields-custom-options-container

Open more actions menu

Repository files navigation

Custom options container for Carbon Fields

This custom container for Carbon Fields provides the ability to overwrite the default template file used to render options panels through a filter.

Requirements

  • Carbon fields
  • Composer

Installation

  1. Install the package via composer by running the command:

composer require pressmodo/carbon-fields-custom-options-container

  1. Create an options panel and set the container type to custom_options instead of theme_options. It's required that you set a page file too.
Container::make( 'custom_options', 'Theme Options' )
	->set_page_file( 'my-options' )
	->add_fields(
		array(
			Field::make( 'text', 'crb_facebook_url' ),
			Field::make( 'textarea', 'crb_footer_text' ),
		)
	);

Usage

In order to setup a custom file to render options pages you'll need to use the filter: "cb_theme_options_{$page_file}_container_file" where {$page_file} is the string set with the set_page_file method mentioned above ("cb_theme_options_my-options_container_file").

Through the filter, you need to return the custom file that'll be loaded to render pages. You can use Carbon Field's existing file as a starting point.

add_filter( 'cb_theme_options_my-options_container_file', function () {
    return 'path/to/custom-file.php';
});

About

A Carbon fields custom options container modified to support custom files for rendering pages.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.