/** * 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; }
function thb_add_post_metabox() { $thb_posts = thb_theme()->getPostType('post'); $thb_metabox = $thb_posts->getMetabox('layout'); if (!$thb_metabox) { return; } if (thb_config('core/blog', 'enable_author_block') || thb_config('core/blog', 'disable_navigation_block')) { $thb_container = $thb_metabox->createContainer(__('Post details', 'thb_text_domain'), 'single_display_settings'); if (thb_config('core/blog', 'enable_author_block')) { $thb_field = new THB_CheckboxField('enable_author_block'); $thb_field->setLabel(__('Author section', 'thb_text_domain')); $thb_field->setHelp(__('Show a secondary section displaying the author\'s name, avatar and short bio.', 'thb_text_domain')); $thb_container->addField($thb_field); } if (thb_config('core/blog', 'disable_navigation_block')) { $thb_field = new THB_CheckboxField('disable_navigation_block'); $thb_field->setLabel(__('Hide navigation', 'thb_text_domain')); $thb_field->setHelp(__('Hide the navigation between posts secondary section.', 'thb_text_domain')); $thb_container->addField($thb_field); } } $thb_container = $thb_metabox->createContainer(__('Related posts', 'thb_text_domain'), 'related'); $thb_field = new THB_CheckboxField('post_related'); $thb_field->setLabel(__('Enable a related posts section', 'thb_text_domain')); $thb_field->setHelp(__('Checking this control automatically creates a "related posts" section at the bottom of the post page.', 'thb_text_domain')); $thb_field->setDynamicDefault('thb_default_post_related'); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('post_related_number'); $thb_field->setLabel(__('Related posts to show', 'thb_text_domain')); $thb_field->setHelp(__('Choose how many related posts you want to display. Defaults to 3.', 'thb_text_domain')); $thb_field->setDynamicDefault('thb_default_post_related_number'); $thb_container->addField($thb_field); $thb_field = new THB_CheckboxField('post_related_thumb'); $thb_field->setLabel(__('Show thumbnails in related posts', 'thb_text_domain')); $thb_field->setHelp(__('Checking this control enables the display of thumbnails for related posts.', 'thb_text_domain')); $thb_field->setDynamicDefault('thb_default_post_related_thumb'); $thb_container->addField($thb_field); $thb_metabox->getContainers(); // thb_theme()->getPostType('post')->addMetabox( $thb_metabox ); }
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); }
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); }
$thb_container->addField($thb_field); $thb_field = new THB_SelectField('shop_sidebar'); $thb_field->setLabel(__('Shop 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('shop_sidebar_position'); $thb_field->setLabel(__('Shop 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_field = new THB_NumberField('shop_products_per_page'); $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)
function thb_home_add_config_metabox() { $thb_container = thb_theme()->getPostType('page')->getMetabox('layout')->createContainer(__('Twitter', 'thb_text_domain'), 'home-config-twitter'); $thb_field = new THB_CheckboxField('enable_twitter_home'); $thb_field->setLabel(__('Enable', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('twitter_home_username'); $thb_field->setLabel(__('Screen name', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('twitter_home_count'); $thb_field->setLabel(__('How many tweets', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_container = thb_theme()->getPostType('page')->getMetabox('layout')->createContainer(__('Social links', 'thb_text_domain'), 'home-config-social'); $thb_field = new THB_CheckboxField('enable_social_home'); $thb_field->setLabel(__('Enable social', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('social_home_services'); $thb_field->setLabel(__('Services list', 'thb_text_domain')); $thb_field->setHelp(__('Comma separated, order matters. Possible values: twitter, facebook, googleplus, flickr, youtube, vimeo, pinterest, dribbble, forrst.', 'thb_text_domain')); $thb_container->addField($thb_field); }
$thb_container = $thb_tab->createContainer(__('Contact form', 'thb_text_domain'), 'contact_form_data'); $thb_field = new THB_TextField('contact_email'); $thb_field->setLabel(__('Email address', 'thb_text_domain')); $thb_field->setHelp(__('Emails from the website\'s contact form will be sent to this address.', 'thb_text_domain')); $thb_container->addField($thb_field); if (thb_config('core/contact', 'map')) { $thb_container = $thb_tab->createContainer(__('Map', 'thb_text_domain'), 'contact_map_data'); $thb_field = new THB_TextField('contact_marker'); $thb_field->setLabel(__('Map marker text', 'thb_text_domain')); $thb_field->setHelp(__('Adding text to the map pin will make it pop up when clicking on it.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('contact_lat_long'); $thb_field->setLabel(__('Map latitude and longitude', 'thb_text_domain')); $thb_field->setHelp(sprintf(__('Insert the latitude and longitude for the Google Map (eg. 44.422, 8.937) in a contact page. Trouble? <a href="%s" target="_blank">Get them here</a>.', 'thb_text_domain'), 'http://itouchmap.com/latlong.html')); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('contact_zoom'); $thb_field->setLabel(__('Map zoom', 'thb_text_domain')); $thb_field->setHelp(__('A reasonable value ranges from 6 to 16; if left blank, the default value will be 10.', 'thb_text_domain')); $thb_container->addField($thb_field); } } /** * Frontend helpers * ----------------------------------------------------------------------------- */ if (!function_exists('thb_contact_map')) { function thb_contact_map($params = array()) { $latlong = thb_get_option('contact_lat_long'); $zoom = thb_get_option("contact_zoom"); $marker = thb_get_option("contact_marker");
/** * Portfolio single entries options */ function thb_portfolio_single_options() { if (thb_portfolio_framework_check()) { $thb_works = thb_theme()->getPostType('works'); $slide_field = new THB_SlideField(thb_portfolio_config('work_slides_key')); $slide_field->setLabel(__('Slide', 'thb-portfolio')); $slide_field = apply_filters('thb_work_slide', $slide_field); if (thb_is_admin_template('single-works.php') && thb_portfolio_config('single')) { $thb_metabox = thb_theme()->getPostType('works')->getMetabox('layout'); $thb_container = $thb_metabox->createContainer(__('Related works', 'thb-portfolio'), 'related_works'); $thb_field = new THB_CheckboxField('works_related'); $thb_field->setLabel(__('Enable a related works section', 'thb-portfolio')); $thb_field->setHelp(__('Selecting "Yes" automatically creates a "related works" section at the bottom of a Portfolio item page.', 'thb-portfolio')); $thb_field->setDynamicDefault('thb_default_works_related'); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('works_related_number'); $thb_field->setLabel(__('Related works to show', 'thb-portfolio')); $thb_field->setHelp(__('Choose how many related works you want to display. Defaults to 3.', 'thb-portfolio')); $thb_field->setDynamicDefault('thb_default_works_related_number'); $thb_container->addField($thb_field); $thb_field = new THB_CheckboxField('works_related_thumb'); $thb_field->setLabel(__('Show thumbnails in related works', 'thb-portfolio')); $thb_field->setHelp(__('Choose to enable the display of thumbnails for related works.', 'thb-portfolio')); $thb_field->setDynamicDefault('thb_default_works_related_thumb'); $thb_container->addField($thb_field); } $thb_metabox = $thb_works->getMetabox('layout'); $thb_tab = $thb_metabox->createTab(__('Project data', 'thb-portfolio'), 'extra'); $thb_tab->setIcon('clipboard'); // $thb_metabox = new THB_Metabox( __('Project data', 'thb-portfolio'), 'extra' ); // $thb_metabox->setPriority('high'); if (thb_portfolio_config('work_external_url')) { $thb_container = $thb_tab->createContainer('', 'data_details'); $field = new THB_TextField('external_url'); $field->setLabel(__('External URL', 'thb-portfolio')); $field->setHelp(__('Insert here an external URL to link to in Portfolio pages directly.', 'thb-portfolio')); $thb_container->addField($field); } if ($work_details = thb_portfolio_config('work_details')) { if ($work_details == 'text') { $thb_container = $thb_tab->createContainer(__('Details', 'thb-portfolio'), 'details'); $field = new THB_TextareaField('prj_info'); $field->setHelp(__('Insert here your project details (Note: accepts basic HTML).', 'thb-portfolio')); $thb_container->addField($field); } elseif ($work_details == 'keyvalue') { $thb_container = $thb_tab->createDuplicableContainer(__('Details', 'thb-portfolio'), 'details'); $thb_container->setIntroText(__('Click on the "Add" button to start inserting a series of key/value pairs details.', 'thb-portfolio')); $thb_container->addControl(__('Add', 'thb-portfolio'), ''); $thb_container->setSortable(); $thb_upload = new THB_KeyValueField('prj_info'); $thb_upload->setLabel(__('Detail', 'thb-portfolio')); $thb_container->setField($thb_upload); } } if (thb_portfolio_config('work_slides')) { if ($work_slides_config = thb_portfolio_config('work_slides_config')) { if (is_callable($work_slides_config)) { $thb_tab->addContainer(call_user_func($work_slides_config)); } } $thb_container = new THB_MetaboxDuplicableFieldsContainer(__('Project images and videos', 'thb-portfolio'), 'slides_container'); $thb_container->setSortable(); $thb_container->addControl(__('Add images', 'thb-portfolio'), 'add_image', '', array('action' => 'thb_add_multiple_slides', 'title' => __('Add images', 'thb-portfolio'))); $thb_container->addControl(__('Add video', 'thb-portfolio'), 'add_video', '', array('action' => 'thb_add_video_slide', 'title' => __('Add video', 'thb-portfolio'))); $thb_container->setField($slide_field); $thb_tab->addContainer($thb_container); // $thb_works->addMetabox($thb_metabox); } } }
function thb_portfolio_single_options() { $thb_metabox = thb_theme()->getPostType('works')->getMetabox('layout'); // $thb_container = $thb_metabox->getContainer( 'layout_container' ); $thb_container = $thb_metabox->createContainer(__('Related works', 'thb_text_domain'), 'related_works'); $thb_field = new THB_CheckboxField('works_related'); $thb_field->setLabel(__('Enable a related works section', 'thb_text_domain')); $thb_field->setHelp(__('Selecting "Yes" automatically creates a "related works" section at the bottom of a Portfolio item page.', 'thb_text_domain')); $thb_field->setDynamicDefault('thb_default_works_related'); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('works_related_number'); $thb_field->setLabel(__('Related works to show', 'thb_text_domain')); $thb_field->setHelp(__('Choose how many related works you want to display. Defaults to 3.', 'thb_text_domain')); $thb_field->setDynamicDefault('thb_default_works_related_number'); $thb_container->addField($thb_field); $thb_field = new THB_CheckboxField('works_related_thumb'); $thb_field->setLabel(__('Show thumbnails in related works', 'thb_text_domain')); $thb_field->setHelp(__('Choose to enable the display of thumbnails for related works.', 'thb_text_domain')); $thb_field->setDynamicDefault('thb_default_works_related_thumb'); $thb_container->addField($thb_field); }
function thb_create_slideshows_posttype_config_container($label = '', $slug = 'slideshow_config_container') { /** * Base configuration fields container. */ $thb_container = new THB_MetaboxFieldsContainer('', $slug); $field = new THB_NumberField('delay'); $field->setLabel(__('Delay', 'thb_text_domain')); $field->setHelp(__('Expressed in seconds.', 'thb_text_domain')); $field->setPlaceholder(__('E.g. 5', 'thb_text_domain')); $thb_container->addField($field); $field = new THB_NumberField('transition_speed'); $field->setLabel(__('Transition speed', 'thb_text_domain')); $field->setHelp(__('Expressed in seconds.', 'thb_text_domain')); $field->setPlaceholder(__('E.g. 1', 'thb_text_domain')); $field->setMin('0'); $field->setStep('0.05'); $thb_container->addField($field); $thb_field = new THB_SelectField('slideshow_type'); $thb_field->setLabel(__('Type', 'thb_text_domain')); $thb_field->setDynamicOptions('thb_slideshows_types'); $thb_field->setInvisibleIfEmpty(true); $thb_container->addField($thb_field); return $thb_container; }