/** * Retrieve a layout option * * @param $key * @param bool $id * @param string $type * @param string $model * * @return array * @since 2.0.0 */ function yit_layout_option($key, $id = false, $type = "post", $model = "post_type") { $option = ''; if (defined('YIT')) { $option = YIT_Layout_Panel()->get_option($key, $id, $type, $model); } else { if (!$id && (is_single() || is_page())) { global $post; $id = $post->ID; } elseif ($id != 'all') { $option = get_post_meta($id, $key); } } return $option; }
/** * Add field to layout panel * */ function yit_add_field_to_layout() { $args = array('slogan_color' => array('label' => __('Slogan color', 'yit'), 'desc' => __('Select a color for the slogan', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => 'show_slogan', 'values' => 'yes')), 'subslogan_color' => array('label' => __('Subslogan color', 'yit'), 'desc' => __('Select a color for the sublogan', 'yit'), 'type' => 'colorpicker', 'std' => '#b0b0b0', 'deps' => array('ids' => 'show_slogan', 'values' => 'yes')), 'slogan_border' => array('label' => __('Enable slogan border', 'yit'), 'desc' => __('Set YES if you want to customize the border of slogan', 'yit'), 'type' => 'onoff', 'std' => 'yes', 'deps' => array('ids' => 'show_slogan', 'values' => 'yes')), 'slogan_border_color' => array('label' => __('Slogan border color', 'yit'), 'desc' => __('Select a color for the border of slogan', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => 'slogan_border', 'values' => 'yes')), 'slogan_image_background' => array('label' => __('Enable slogan background', 'yit'), 'desc' => __('Set YES if you want to customize the background of slogan', 'yit'), 'type' => 'onoff', 'std' => 'no', 'deps' => array('ids' => 'show_slogan', 'values' => 'yes')), 'slogan_image_height' => array('label' => __('Slogan height', 'yit'), 'desc' => __('Set 0 for auto height', 'yit'), 'type' => 'number', 'std' => '0', 'min' => '0', 'max' => '1000', 'deps' => array('ids' => 'slogan_image_background', 'values' => 'yes')), 'slogan_bg_color' => array('label' => __('Slogan background color', 'yit'), 'desc' => __('Select a background color for the slogan', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => 'slogan_image_background', 'values' => 'yes')), 'slogan_bg_image' => array('label' => __('Slogan background image', 'yit'), 'desc' => __('Select a background image for the slogan.', 'yit'), 'type' => 'upload', 'std' => '', 'deps' => array('ids' => 'slogan_image_background', 'values' => 'yes')), 'slogan_bg_repeat' => array('label' => __('Background repeat', 'yit'), 'desc' => __('Select the repeat mode for the background image.', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'repeat' => __('Repeat', 'yit'), 'repeat-x' => __('Repeat Horizontally', 'yit'), 'repeat-y' => __('Repeat Vertically', 'yit'), 'no-repeat' => __('No Repeat', 'yit')), 'std' => 'default', 'deps' => array('ids' => 'slogan_image_background', 'values' => 'yes')), 'slogan_bg_position' => array('label' => __('Background position', 'yit'), 'desc' => __('Select the position for the background image.', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'center' => __('Center', 'yit'), 'top left' => __('Top left', 'yit'), 'top center' => __('Top center', 'yit'), 'top right' => __('Top right', 'yit'), 'bottom left' => __('Bottom left', 'yit'), 'bottom center' => __('Bottom center', 'yit'), 'bottom right' => __('Bottom right', 'yit')), 'std' => 'default', 'deps' => array('ids' => 'slogan_image_background', 'values' => 'yes')), 'slogan_bg_attachment' => array('label' => __('Background attachment', 'yit'), 'desc' => __('Select the attachment for the background image.', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'scroll' => __('Scroll', 'yit'), 'fixed' => __('Fixed', 'yit')), 'std' => 'default', 'deps' => array('ids' => 'slogan_image_background', 'values' => 'yes')), 'sep4' => array('type' => 'sep'), 'enable_dark_header' => array('label' => __('Enable style for dark header', 'yit'), 'desc' => __('Set YES to change the style of typography in header, useful if you are using the transparent header and you have a dark static image.', 'yit'), 'type' => 'onoff', 'std' => 'no')); YIT_Layout_Panel()->add_option('setting', $args, $where = 'after'); YIT_Layout_Panel()->remove_panel('google_map'); }
/** * Add Default Options * * Add custom options in database * * @return void * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ public function add_default_options() { $model_options = get_option($this->prefix . 'site_site'); $panel_options = YIT_Layout_Panel()->options; $default_option = array(); if (!$model_options) { foreach ($panel_options as $id_box => $box) { if (isset($box['fields'])) { foreach ($box['fields'] as $id_field => $field) { if (isset($field['std'])) { $default_option['all'][$id_box][$id_field] = $field['std']; } } } } } add_option($this->prefix . 'site_site', $default_option); }
/** * Add Panel to YIT_Layout subpanel * * Add a panel to Layout panel * * @return void * @since 1.0.0 * @author Francesco Licandro <*****@*****.**> */ public function add_layout_panel() { YIT_Layout_Panel()->add_panel(array('seo' => array('label' => __('SEO', 'yit'), 'fields' => array('seo_title' => array('label' => __('Page title', 'yit'), 'desc' => __('Page title for head "title" tag', 'yit'), 'type' => 'text', 'std' => ''), 'seo_description' => array('label' => __('Page description', 'yit'), 'desc' => __('Page description for description meta-tag', 'yit'), 'type' => 'textarea', 'std' => ''), 'seo_keywords' => array('label' => __('Page Keywords', 'yit'), 'desc' => __('Page keywords for keywords meta-tag', 'yit'), 'type' => 'text', 'std' => ''))))); }
/** * Add Panel to YIT_Layout subpanel * * Add a panel to Layout panel if YIT_sidebar is active * * @return void * @since 1.0.0 * @author Antonio La Rocca <*****@*****.**> */ public function add_layout_panel() { //check if yit-sidebar in active if (defined('YIT_LAYOUT')) { //add a panel to Layout Subpanel YIT_Layout_Panel()->add_panel(array('sitemap' => array('label' => __('Sitemap', 'yit'), 'fields' => array('display' => array('label' => __('Display this page in the sitemap', 'yit'), 'desc' => __('Check if you want to show this page in the sitemap', 'yit'), 'type' => 'onoff', 'std' => 'yes')))), 'after'); } }
/** * Add the slider option in the layout settings of YIT Layout plugin * * @return void * @since 1.0 * @author Antonino Scarfì <*****@*****.**> */ public function add_slider_option_layout() { if (!function_exists('YIT_Layout_Panel')) { return; } $sliders = get_posts("post_type={$this->sliders_post_type}&posts_per_page=-1"); $options = array('none' => __('None', 'yit')); foreach ($sliders as $slider) { $options[$slider->post_name] = $slider->post_title; } $field = array('slider_name' => array('label' => __('Slider', 'yit'), 'desc' => __('Select the slider to use in this page', 'yit'), 'type' => 'select', 'options' => $options, 'std' => '')); YIT_Layout_Panel()->add_option('header', array('sep3' => array('type' => 'sep'))); YIT_Layout_Panel()->add_option('header', $field); }
/** * Add field to layout panel * */ function yit_add_field_to_layout() { $args = array('slogan_text_color' => array('label' => __('Slogan color', 'yit'), 'desc' => __('Select a color for the slogan', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_text_bg_color' => array('label' => __('Slogan background color', 'yit'), 'desc' => __('Select a background color for the text of slogan', 'yit'), 'type' => 'colorpicker', 'std' => '#040404', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_highlight_color' => array('label' => __('Slogan highlight text color', 'yit'), 'desc' => __('Select the color of the text for the hightlight of the slogan that you can get writing [text]', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_highlight_bg_color' => array('label' => __('Slogan highlight text color', 'yit'), 'desc' => __('Select the color of the background for the hightlight of the slogan that you can get writing [text]', 'yit'), 'type' => 'colorpicker', 'std' => '#c11200', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'subslogan_color' => array('label' => __('Subslogan color', 'yit'), 'desc' => __('Select a color for the sublogan', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_image_background' => array('label' => __('Enable slogan background', 'yit'), 'desc' => __('Set YES if you want to customize the background of slogan', 'yit'), 'type' => 'onoff', 'std' => 'no', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_image_height' => array('label' => __('Slogan height', 'yit'), 'desc' => __('Set 0 for auto height', 'yit'), 'type' => 'number', 'std' => '0', 'min' => '0', 'max' => '1000', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_bg_color' => array('label' => __('Slogan background color', 'yit'), 'desc' => __('Select a background color for the slogan', 'yit'), 'type' => 'colorpicker', 'std' => '#ffffff', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_bg_image' => array('label' => __('Slogan background image', 'yit'), 'desc' => __('Select a background image for the slogan.', 'yit'), 'type' => 'upload', 'std' => '', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_bg_repeat' => array('label' => __('Background repeat', 'yit'), 'desc' => __('Select the repeat mode for the background image.', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'repeat' => __('Repeat', 'yit'), 'repeat-x' => __('Repeat Horizontally', 'yit'), 'repeat-y' => __('Repeat Vertically', 'yit'), 'no-repeat' => __('No Repeat', 'yit')), 'std' => 'default', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_bg_position' => array('label' => __('Background position', 'yit'), 'desc' => __('Select the position for the background image.', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'center' => __('Center', 'yit'), 'top left' => __('Top left', 'yit'), 'top center' => __('Top center', 'yit'), 'top right' => __('Top right', 'yit'), 'bottom left' => __('Bottom left', 'yit'), 'bottom center' => __('Bottom center', 'yit'), 'bottom right' => __('Bottom right', 'yit')), 'std' => 'default', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes')), 'slogan_bg_attachment' => array('label' => __('Background attachment', 'yit'), 'desc' => __('Select the attachment for the background image.', 'yit'), 'type' => 'select', 'options' => array('default' => __('Default', 'yit'), 'scroll' => __('Scroll', 'yit'), 'fixed' => __('Fixed', 'yit')), 'std' => 'default', 'deps' => array('ids' => '_show_slogan', 'values' => 'yes'))); YIT_Layout_Panel()->add_option('setting', $args, $where = 'after'); YIT_Layout_Panel()->remove_panel('google_map'); }
} } if ($this->current_panel['model'] == 'static') { if ($this->current_panel['id'] != 'all') { $html .= '<p>' . __('Name', 'yit') . ': <strong>' . $this->current_panel['id'] . '</strong>' . '</p>'; } else { $html .= '<p>' . __('All ', 'yit') . $this->current_panel['type'] . '</p>'; } } return $html; } } /** * Main instance of plugin * * @return \YIT_Layout_Panel * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ function YIT_Layout_Panel() { return YIT_Layout_Panel::instance(); } /** * Instantiate Sidebar class * * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ YIT_Layout_Panel();
/** * Yit Layout Panel * * print HTML code to layout panel * * @return void * @since 1.0 * @author Emanuela Castorina <*****@*****.**> */ public function yit_layout_panel() { yit_get_template('/admin/layout/panel.php', array('options' => YIT_Layout_Panel()->options)); }