/** * Add Beans post meta. * * @since 1.0.0 */ function beans_do_register_post_meta() { // Get layout option without default for the count. $options = beans_get_layouts_for_options(); // Stop here if there is less than two layouts options. if (count($options) < 2) { return; } $fields = array(array('id' => 'beans_layout', 'label' => _x('Layout', 'post meta', 'tm-beans'), 'type' => 'radio', 'default' => 'default_fallback', 'options' => beans_get_layouts_for_options(true))); beans_register_post_meta($fields, array('post', 'page'), 'tm-beans', array('title' => __('Post Options', 'tm-beans'))); }
/** * Add Beans options to the WordPress Customizer. * * @since 1.0.0 */ function beans_do_register_wp_customize_options() { $fields = array(array('id' => 'beans_logo_image', 'label' => __('Logo Image', 'tm-beans'), 'type' => 'WP_Customize_Image_Control', 'transport' => 'refresh')); beans_register_wp_customize_options($fields, 'title_tagline', array('title' => __('Branding', 'tm-beans'))); // Get layout option without default for the count. $options = beans_get_layouts_for_options(); // Only show the layout options if more than two layouts are registered. if (count($options) > 2) { $fields = array(array('id' => 'beans_layout', 'label' => __('Default Layout', 'tm-beans'), 'type' => 'radio', 'default' => beans_get_default_layout(), 'options' => $options, 'transport' => 'refresh')); beans_register_wp_customize_options($fields, 'beans_layout', array('title' => __('Default Layout', 'tm-beans'), 'priority' => 1000)); } $fields = array(array('id' => 'beans_viewport_width_group', 'label' => __('Viewport Width', 'tm-beans'), 'type' => 'group', 'fields' => array(array('id' => 'beans_enable_viewport_width', 'type' => 'activation', 'default' => false), array('id' => 'beans_viewport_width', 'type' => 'slider', 'default' => 1000, 'min' => 300, 'max' => 2500, 'interval' => 10, 'unit' => 'px'))), array('id' => 'beans_viewport_height_group', 'label' => __('Viewport Height', 'tm-beans'), 'type' => 'group', 'fields' => array(array('id' => 'beans_enable_viewport_height', 'type' => 'activation', 'default' => false), array('id' => 'beans_viewport_height', 'type' => 'slider', 'default' => 1000, 'min' => 300, 'max' => 2500, 'interval' => 10, 'unit' => 'px')))); beans_register_wp_customize_options($fields, 'beans_preview', array('title' => __('Preview Tools', 'tm-beans'), 'priority' => 1010)); }