Add Option Type
-
Topic
-
I’m trying to add a new sortable option type (ala social icons).
Immediately after the framework in child functions.php I added:/** * Header Elements buttons option type * * @since 2.5.0 */ class JMA_Sortable_Headers extends Theme_Blvd_Sortable_Option { /** * Constructor * * @since 2.5.0 */ public function __construct() { // Set type $this->type = 'sortable_header'; // Run parent parent::__construct(); } /** * Get options * * @since 2.5.0 */ public function get_options() { $options = array( array( 'id' => 'header_element', 'name' => __('Header Element', 'themeblvd'), 'type' => 'select', 'std' => 'content', 'options' => array( 'content' => 'Content', '#access' => 'Primary Menu', '#access2' => 'Secondary Menu', 'image' => 'Header Image or Slider', ), 'trigger' => true // Triggers this option's value to be used in toggle ), array( 'id' => 'contents', 'name' => __('Element Contents', 'themeblvd'), 'type' => 'multicheck', 'std' => array( 'logo' => 1, 'widget' => 1, 'nav_btn' => 0 ) , 'options' => array( 'logo' => 'Logo', 'widget' => 'Header Widget', 'nav_btn' => 'Mobile Nav Button (use exactly once)' ) ), ); return $options; } /** * Get labels * * @since 2.5.0 */ public function get_labels() { $labels = array( 'add' => __('Add Header Element','themeblvd'), 'delete' => __('Delete Header Element','themeblvd'), 'delete_confirm' => __('Are you sure you want to delete this header element?', 'themeblvd'), 'delete_all' => __('Delete All Header Elements','themeblvd'), 'delete_all_confirm' => __('Are you sure you want to delete all header elements?','themeblvd') ); return $labels; } }
I have a feeling I need to instantiate this or something?
Any way the I add:$name = 'Header Setup'; $description = 'A couple of additional changes to basic layout.'; $options = array( array( 'name' => 'Sortable Header Items', 'desc' => 'Description', 'id' => 'header_content', 'std' => array( 'item_1' => array( 'header_element' => 'content', 'contents' => array( 'logo' => 1, 'widget' => 1, 'nav_btn' => 1 ) ), 'item_2' => array( 'header_element' => '#access', 'contents' => array( 'logo' => 0, 'widget' => 0, 'nav_btn' => 0 ) ), 'item_3' => array( 'header_element' => 'image', 'contents' => array( 'logo' => 0, 'widget' => 0, 'nav_btn' => 0 ) ) ), 'type' => 'sortable_header' ) ); themeblvd_add_option_section( 'jma_styles_header', 'jma_header_options', $name, $description, $options, true );
Just the title and description show up. As I said above, I think I need to do something with my new class to cause it to register.
thx,
John
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.