Пример #1
0
/**
 * Main page options tab.
 */
function thb_portfolio_options()
{
    if (thb_portfolio_framework_check() && thb_portfolio_config('options')) {
        $thb_page = thb_theme()->getAdmin()->getMainPage();
        $thb_tab = new THB_Tab(__('Portfolio', 'thb-portfolio'), 'portfolio');
        $thb_container = $thb_tab->createContainer('', 'single_work_options');
        $thb_field = new THB_TextField('works_url_slug');
        $thb_field->setLabel(__('URL slug', 'thb-portfolio'));
        $thb_field->setHelp(sprintf(__('URL slug for Portfolio items. Defaults to "works". Remember to <a href="%s">re-save the site\'s permalinks</a>.', 'thb-portfolio'), admin_url('options-permalink.php')));
        $thb_container->addField($thb_field);
        if (thb_portfolio_config('works_navigation')) {
            $thb_field = new THB_YesNoField('works_navigation');
            $thb_field->setLabel(__('Enable navigation between Portfolio items', 'thb-portfolio'));
            $thb_container->addField($thb_field);
        }
        if (thb_portfolio_config('portfolio_index')) {
            $thb_field = new THB_SelectField('portfolio_index');
            $thb_field->setLabel(__('Select the Portfolio index', 'thb-portfolio'));
            $thb_field->setHelp(__('Choose the index page for your portfolio items "back to portfolio" link.', 'thb-portfolio'));
            $thb_field->setOptions(thb_get_pages_for_select('template-portfolio.php'));
            $thb_container->addField($thb_field);
        }
        $thb_page->addTab($thb_tab);
    }
}
Пример #2
0
 function thb_add_footerstripes_posttype_config_metabox()
 {
     $consumer_key = thb_get_option('twitter_consumer_key');
     $consumer_secret = thb_get_option('twitter_consumer_secret');
     $oauth_token = thb_get_option('twitter_oauth_token');
     $oauth_token_secret = thb_get_option('twitter_oauth_token_secret');
     $config_note = '';
     if ($consumer_key == '' || $consumer_secret == '' || $oauth_token == '' || $oauth_token_secret == '') {
         $config_note = __('Make sure to fill the required Twitter API settings in the "Theme options > Social" tab.', 'thb_text_domain');
     }
     $post_type = thb_theme()->getPostType('footerstripes');
     $thb_metabox = new THB_Metabox(__('Footer contents', 'thb_text_domain'), 'footerstripes_config');
     $thb_container = $thb_metabox->createContainer('', 'footerstripes_config_container');
     $thb_field = new THB_SelectField('footerstripes_content_type');
     $thb_field->setLabel(__('Content type', 'thb_text_domain'));
     $thb_field->setOptions(array('twitter' => __('Twitter', 'thb_text_domain'), 'call-to-action' => __('Call to action', 'thb_text_domain'), 'social' => __('Social', 'thb_text_domain')));
     $thb_container->addField($thb_field);
     // Twitter
     $thb_container = $thb_metabox->createContainer(__('Twitter', 'thb_text_domain'), 'footerstripes_content_type_twitter');
     $thb_container->setIntroText($config_note);
     $thb_field = new THB_TextField('footerstripes_twitter_username');
     $thb_field->setLabel(__('Username', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_NumberField('footerstripes_twitter_num');
     $thb_field->setLabel(__('Tweets #', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     // Social
     $thb_container = $thb_metabox->createContainer(__('Social', 'thb_text_domain'), 'footerstripes_content_type_social');
     $thb_field = new THB_TextField('footerstripes_social_services');
     $thb_field->setLabel(__('Services', 'thb_text_domain'));
     $thb_field->setHelp(__('Comma separated, order matters', 'thb_text_domain') . '. ' . __('Possible values', 'thb_text_domain') . ': twitter, facebook, googleplus, flickr, youtube, vimeo, pinterest, dribbble, forrst.');
     $thb_container->addField($thb_field);
     // Call to action
     $thb_container = $thb_metabox->createContainer(__('Call to action', 'thb_text_domain'), 'footerstripes_content_type_call-to-action');
     $thb_field = new THB_TextField('footerstripes_call-to-action_big_text');
     $thb_field->setLabel(__('Big text', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_TextareaField('footerstripes_call-to-action_small_text');
     $thb_field->setLabel(__('Small text', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_TextField('footerstripes_call-to-action_btn_text');
     $thb_field->setLabel(__('Button text', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_TextField('footerstripes_call-to-action_btn_url');
     $thb_field->setLabel(__('Button URL', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $post_type->addMetabox($thb_metabox);
 }
Пример #3
0
 /**
  * Create the sidebar management metabox fields container.
  *
  * @param string $post_type The post type.
  * @return void
  */
 function thb_sidebars_metabox_container($post_type = null)
 {
     $thb_container = new THB_MetaboxFieldsContainer(__('Page sidebar', 'thb_text_domain'), 'sidebar_config');
     $field = new THB_SelectField('sidebar');
     $field->setLabel(__('Sidebar to display', 'thb_text_domain'));
     $field->setOptions(array(0 => __('No sidebar', 'thb_text_domain')));
     $field->setDynamicOptions('thb_get_sidebars_for_select');
     if ($post_type) {
         $field->setDynamicDefault('thb_get_post_type_sidebar', $post_type);
     }
     $thb_container->addField($field);
     $field = new THB_SelectField('sidebar_position');
     $field->setLabel(__('Position', 'thb_text_domain'));
     $field->setOptions(array('sidebar-right' => __('Right', 'thb_text_domain'), 'sidebar-left' => __('Left', 'thb_text_domain')));
     $thb_container->addField($field);
     return $thb_container;
 }
Пример #4
0
 function thb_photogallery_container()
 {
     $thb_theme = thb_theme();
     $thb_photogallery_page_template = thb_config('core/photogallery', 'templates');
     if (thb_is_admin_template($thb_photogallery_page_template)) {
         $thb_metabox = new THB_Metabox(__('Gallery', 'thb_text_domain'), 'slideshow');
         $thb_container = $thb_metabox->createContainer(__('Configuration', 'thb_text_domain'), 'photogallery_masonry_details_container');
         $thb_field = new THB_NumberField('slides_per_page');
         $thb_field->setLabel(__('Pictures per page', 'thb_text_domain'));
         // $thb_field->setHelp( __('In case of AJAX loading, chose how many pictures to display.', 'thb_text_domain') );
         $thb_field->setHelp(__('Choose how many pictures to load dinamically. Leaving this empty will show all the images available.', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_SelectField('portfolio_columns');
         $thb_field->setLabel(thb_config('core/photogallery', 'grid_templates_columns_label'));
         $thb_field->setOptions(thb_config('core/photogallery', 'grid_templates_columns'));
         $thb_container->addField($thb_field);
         $image_sizes = thb_config('core/photogallery', 'image_sizes');
         if (!empty($image_sizes)) {
             $slides_size_options = array();
             if (is_array(current($image_sizes))) {
                 $slides_size_options[] = __('Fixed', 'thb_text_domain');
                 $slides_size_options[] = __('Variable', 'thb_text_domain');
             } else {
                 $slides_size_options[$image_sizes[0]] = __('Fixed', 'thb_text_domain');
                 $slides_size_options[$image_sizes[1]] = __('Variable', 'thb_text_domain');
             }
             $thb_field = new THB_SelectField('slides_size');
             $thb_field->setLabel(__('Photos height', 'thb_text_domain'));
             $thb_field->setOptions($slides_size_options);
             $thb_container->addField($thb_field);
         }
         $thb_container = $thb_metabox->createDuplicableContainer(__('Photos', 'thb_text_domain'), 'photogallery_slides');
         $thb_container->setSortable();
         $thb_container->addControl(__('Add photo', 'thb_text_domain'), 'add_image', 'images.png', array('action' => 'thb_add_multiple_slides', 'title' => __('Add photos', 'thb_text_domain')));
         $field = new THB_SlideField('photogallery_slide');
         $field->setLabel(__('Slide', 'thb_text_domain'));
         $thb_container->setField($field);
         $thb_theme->getPostType('page')->addMetabox($thb_metabox);
     }
 }
 function thb_woocommerce_extra_options()
 {
     $thb_theme = thb_theme();
     $thb_page = $thb_theme->getAdmin()->getMainPage();
     $thb_tab = $thb_page->getTab('woocommerce');
     $thb_container = $thb_tab->createContainer(__('Shop general options', 'thb_text_domain'), 'woocommerce_general_options');
     $thb_field = new THB_YesNoField('enable_shop_cart_allpages');
     $thb_field->setLabel(__('Enable shop cart on all pages', 'thb_text_domain'));
     $thb_field->setHelp(__('Choose if you want to enable the shop cart on header on all pages or only for "Shop" related pages.', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_container = $thb_tab->getContainer('woocommerce_shop_options');
     $thb_field = new THB_SelectField('woocommerce_shop_pageheader_layout');
     $thb_field->setLabel(__('Page header layout', 'thb_text_domain'));
     $thb_field->setOptions(array('left' => __('Left', 'thb_text_domain'), 'center' => __('Center', 'thb_text_domain'), 'right' => __('Right', 'thb_text_domain')));
     $thb_container->addField($thb_field);
     $thb_field = new THB_SelectField('woocommerce_shop_pageheader_height');
     $thb_field->setLabel(__('Page header height', 'thb_text_domain'));
     $thb_field->setOptions(array('pageheader-big' => __('Large', 'thb_text_domain'), 'pageheader-compact' => __('Compact', 'thb_text_domain')));
     $thb_field->setHelp(__('This setting will affect also the shop\'s archive and taxonomy pages.', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_UploadField('woocommerce_shop_pageheader_background_image');
     $thb_field->setLabel(__('Page header background image', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_NumberField('woocommerce_shop_pageheader_background_opacity');
     $thb_field->setMin(0);
     $thb_field->setMax(1);
     $thb_field->setStep(0.05);
     $thb_field->setLabel(__('Page header background opacity', 'thb_text_domain'));
     $thb_container->addField($thb_field);
 }
Пример #6
0
$thb_field->setLabel(__('Products to show', 'thb_text_domain'));
$thb_field->setHelp(__('Choose how many products will be displayed on Shop page.', 'thb_text_domain'));
$thb_container->addField($thb_field);
$thb_container = $thb_tab->createContainer(__('Product page options', 'thb_text_domain'), 'woocommerce_product_options');
$thb_field = new THB_NumberField('related_products_per_page');
$thb_field->setLabel(__('Related product to show', 'thb_text_domain'));
$thb_field->setHelp(__('Choose how many related posts will be displayed on single product page.', 'thb_text_domain'));
$thb_container->addField($thb_field);
$thb_field = new THB_SelectField('product_sidebar');
$thb_field->setLabel(__('Product page sidebar', 'thb_text_domain'));
$thb_field->setOptions(array(0 => __('No sidebar', 'thb_text_domain')));
$thb_field->setDynamicOptions('thb_get_sidebars_for_select');
$thb_container->addField($thb_field);
$thb_field = new THB_SelectField('product_sidebar_position');
$thb_field->setLabel(__('Product page sidebar position', 'thb_text_domain'));
$thb_field->setOptions(array('sidebar-left' => __('Left', 'thb_text_domain'), 'sidebar-right' => __('Right', 'thb_text_domain')));
$thb_container->addField($thb_field);
$thb_page->addTab($thb_tab);
if (!function_exists('thb_shop_columns_layout')) {
    function thb_shop_columns_layout($classes)
    {
        if (is_woocommerce()) {
            $classes[] = 'thb-shop-' . thb_get_option('shop_columns') . 'col';
        }
        return $classes;
    }
    add_action('body_class', 'thb_shop_columns_layout');
}
if (!function_exists('thb_loop_columns')) {
    function thb_loop_columns()
    {
Пример #7
0
 function thb_theme_layout_options()
 {
     global $page_templates, $single_post, $portfolio, $masonry, $page_layout_templates;
     $thb_container = new THB_MetaboxFieldsContainer('', 'extra_container');
     $thb_field = new THB_SelectField('pageheader_layout');
     $thb_field->setLabel(__('Page header alignment', 'thb_text_domain'));
     $thb_field->setOptions(array('left' => __('Left', 'thb_text_domain'), 'center' => __('Center', 'thb_text_domain'), 'right' => __('Right', 'thb_text_domain')));
     $thb_container->addField($thb_field);
     $thb_field = new THB_SelectField('pageheader_height');
     $thb_field->setLabel(__('Page header height', 'thb_text_domain'));
     $thb_field->setOptions(array('pageheader-big' => __('Large', 'thb_text_domain'), 'pageheader-compact' => __('Compact', 'thb_text_domain')));
     $thb_container->addField($thb_field);
     $thb_field = new THB_ColorField('background_color');
     $thb_field->setLabel(__('Background color', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_NumberField('background_opacity');
     $thb_field->setLabel(__('Background opacity', 'thb_text_domain'));
     $thb_field->setMin('0');
     $thb_field->setMax('1');
     $thb_field->setStep('0.05');
     $thb_field->setDefault('0.85');
     $thb_container->addField($thb_field);
     foreach ($page_layout_templates as $template) {
         if (thb_is_admin_template($template)) {
             $post_type = thb_theme()->getPostType(thb_get_post_type_from_template($template));
             $post_type->getMetabox('layout')->addContainer($thb_container);
         }
     }
 }
Пример #8
0
 function thb_add_portfolio_metabox()
 {
     $ajax = thb_config('core/portfolio', 'ajax');
     $thb_metabox = new THB_Metabox(__('Portfolio items', 'thb_text_domain'), 'portfolio_loop');
     $thb_metabox->setPriority('high');
     $thb_container = $thb_metabox->createContainer('', 'portfolio_loop_container');
     $thb_field = new THB_QueryFilterField('works_query');
     $thb_field->setTaxonomies(thb_get_post_type_taxonomies('works'));
     if (thb_is_admin_template(thb_config('core/portfolio', 'pagination_disabled'))) {
         $thb_field->setHideNum();
     }
     $thb_container->addField($thb_field);
     if (!empty($ajax)) {
         if (thb_is_admin_template($ajax)) {
             $thb_field = new THB_YesNoField('works_ajax_pagination');
             $thb_field->setLabel(__('Use AJAX pagination', 'thb_text_domain'));
             $thb_field->setHelp(__('If the page template supports this feature (e.g. its items are filterable), enabling AJAX pagination won\'t refresh your page while filtering through Portfolio items.', 'thb_text_domain'));
             $thb_container->addField($thb_field);
         }
     }
     thb_theme()->getPostType('page')->addMetabox($thb_metabox);
     if (thb_check_template_config('core/portfolio', 'grid_templates')) {
         $thb_metabox = thb_theme()->getPostType('page')->getMetabox('layout');
         $thb_container = $thb_metabox->getContainer('layout_container');
         $thb_field = new THB_SelectField('portfolio_columns');
         $thb_field->setLabel(thb_config('core/portfolio', 'grid_templates_columns_label'));
         $thb_field->setOptions(thb_config('core/portfolio', 'grid_templates_columns'));
         $thb_container->addField($thb_field);
         $grid_image_sizes = thb_config('core/portfolio', 'grid_image_sizes');
         if (!empty($grid_image_sizes)) {
             $grid_size_options = array();
             if (is_array(current($grid_image_sizes))) {
                 $grid_size_options[] = __('Fixed', 'thb_text_domain');
                 $grid_size_options[] = __('Variable', 'thb_text_domain');
             } else {
                 $grid_size_options[$grid_image_sizes[0]] = __('Fixed', 'thb_text_domain');
                 $grid_size_options[$grid_image_sizes[1]] = __('Variable', 'thb_text_domain');
             }
             $thb_field = new THB_SelectField('portfolio_grid_image_sizes');
             $thb_field->setLabel(__('Thumbnails height', 'thb_text_domain'));
             $thb_field->setOptions($grid_size_options);
             $thb_container->addField($thb_field);
         }
     }
 }
Пример #9
0
$thb_config = array('options' => true, 'options_logo_position' => array('logo-left' => __('Left', 'thb_text_domain'), 'logo-center' => __('Center', 'thb_text_domain'), 'logo-right' => __('Right', 'thb_text_domain')), 'meta_options' => true, 'meta_options_subtitle' => true, 'meta_options_pageheader_disable' => true, 'meta_options_page_boxed' => true, 'meta_options_gutter' => true, 'meta_options_gutter_default' => true);
$thb_theme->setConfig('core/layout', thb_array_asum($thb_config, $config));
/**
 * Options tab
 * -----------------------------------------------------------------------------
 */
$thb_page = $thb_theme->getAdmin()->getMainPage();
$thb_tab = new THB_Tab(__('Layout', 'thb_text_domain'), 'layout');
/**
 * Header
 */
$thb_container = $thb_tab->createContainer(__('Header', 'thb_text_domain'), 'layout_options_header');
if (thb_config('core/layout', 'options_logo_position') !== false) {
    $thb_field = new THB_SelectField('logo_position');
    $thb_field->setLabel(__('Logo position', 'thb_text_domain'));
    $thb_field->setOptions(thb_config('core/layout', 'options_logo_position'));
    $thb_container->addField($thb_field);
}
/**
 * Footer
 */
$thb_container = $thb_tab->createContainer(__('Footer', 'thb_text_domain'), 'layout_options_footer');
/**
 * Customizations
 */
if (!function_exists('thb_layout_custom_css')) {
    function thb_layout_custom_css()
    {
        $thb_tab = thb_theme()->getAdmin()->getMainPage()->getTab('layout');
        $thb_container = $thb_tab->createContainer(__('Customizations', 'thb_text_domain'), 'layout_options_customizations');
        $thb_field = new THB_TextareaField('custom_css');
Пример #10
0
 /**
  * Created the Flexslider configuration options container.
  *
  * @param strubg $label The container label.
  * @param strubg $slug The container slug.
  * @return THB_MetaboxFieldsContainer
  */
 function thb_flexslider_config_create_container($label = '', $slug = 'flexslider_options')
 {
     if (empty($label)) {
         $label = __('Flexslider options', 'thb_text_domain');
     }
     $thb_container = new THB_MetaboxFieldsContainer($label, $slug);
     $field = new THB_NumberField('slideshowHeight');
     $field->setLabel(__('Height', 'thb_text_domain'));
     $field->setMin('0');
     $thb_container->addField($field);
     $field = new THB_YesNoField('flexslider_smoothHeight');
     $field->setLabel(__('Variable height', 'thb_text_domain'));
     $field->setDefault('1');
     $thb_container->addField($field);
     $field = new THB_SelectField('flexslider_effects');
     $field->setLabel(__('Effects', 'thb_text_domain'));
     $field->setOptions(array('fade' => __('Fade', 'thb_text_domain'), 'slide' => __('Slide', 'thb_text_domain')));
     $thb_container->addField($field);
     return $thb_container;
 }