/** * Build the block modals. */ private function buildModals() { $thb_modal = new THB_Modal($this->getTitle(), $this->getSlug()); $thb_modal_container = $thb_modal->createContainer('', $this->getSlug() . '_container'); $thb_field = new THB_TextField('title'); $thb_field->setLabel(__('Title', 'thb-portfolio')); $thb_modal_container->addField($thb_field); $thb_field = new THB_GraphicRadioField('layout'); $thb_field->setLabel(__('Layout', 'thb_text_domain')); $thb_field->setOptions(thb_portfolio_config('builder_portfolio_layouts')); $thb_modal_container->addField($thb_field); thb_grid_layout_add_fields($thb_modal_container, thb_portfolio_config('grid_builder_columns')); $thb_field = new THB_QueryFilterField('query_filter'); $thb_field->addClass('full'); $thb_field->setTaxonomies(thb_get_post_type_taxonomies('works')); $thb_modal_container->addField($thb_field); $thb_field = new THB_CheckboxField('disable_filter'); $thb_field->setLabel(__('Disable filter', 'thb-portfolio')); $thb_modal_container->addField($thb_field); $thb_field = new THB_YesNoField('works_ajax_pagination'); $thb_field->setLabel(__('Use AJAX pagination', 'thb-portfolio')); $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-portfolio')); $thb_modal_container->addField($thb_field); $thb_modal_container = $thb_modal->createContainer(__('Carousel', 'thb_text_domain'), $this->getSlug() . '_carousel_container'); thb_carousel_options($thb_modal_container); $this->addModal($thb_modal); }
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); } } }
/** * Portfolio page templates options metabox */ function thb_add_portfolio_metabox() { if (thb_portfolio_framework_check() && thb_portfolio_config('metabox') && thb_is_admin_template(thb_portfolio_config('templates'))) { $ajax = thb_portfolio_config('ajax'); $grid = thb_portfolio_config('grid_templates'); $grid_columns = thb_portfolio_config('grid_templates_columns'); $thb_metabox = thb_theme()->getPostType('page')->getMetabox('layout'); $thb_tab = $thb_metabox->createTab(__('Portfolio options', 'thb-portfolio'), 'portfolio_options'); $thb_tab->setIcon('welcome-view-site'); $thb_container = $thb_tab->createContainer('', 'portfolio_loop_container'); if (!empty($grid)) { if (thb_is_admin_template($grid)) { $current_template = thb_get_admin_template(); // if ( isset( $grid_columns[$current_template] ) ) { if (in_array($current_template, array_keys($grid_columns))) { thb_grid_layout_add_fields($thb_container, $grid_columns[$current_template]); } } } $thb_container = $thb_tab->createContainer('Filtering & ordering', 'portfolio_filtering_container'); $thb_field = new THB_QueryFilterField('works_query'); $thb_field->addClass('full'); $thb_field->setTaxonomies(thb_get_post_type_taxonomies('works')); if (thb_is_admin_template(thb_portfolio_config('pagination_disabled_templates'))) { $thb_field->setHideNum(); } $thb_container->addField($thb_field); $thb_container = $thb_tab->getContainer('portfolio_loop_container'); if (!empty($ajax)) { if (thb_is_admin_template($ajax)) { $thb_field = new THB_YesNoField('works_ajax_pagination'); $thb_field->setLabel(__('Use AJAX pagination', 'thb-portfolio')); $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-portfolio')); $thb_container->addField($thb_field); } } } }
/** * Create a slides metabox in Slideshow post type pages. * * @return THB_Metabox */ function thb_create_slideshows_posttype_slides_metabox() { $thb_metabox = new THB_Metabox(__('Slideshow contents', 'thb_text_domain'), 'slideshow_contents'); $thb_metabox->setPriority('high'); $thb_container = new THB_MetaboxFieldsContainer('', 'slideshow_contents_container'); $thb_field = new THB_SelectField('slideshow_contents'); $thb_field->setLabel(__('Select slides from', 'thb_text_domain')); $thb_field->setDynamicOptions('thb_slideshow_contents'); $thb_container->addField($thb_field); $thb_metabox->addContainer($thb_container); $thb_container = thb_create_slideshows_slides_container(); $thb_metabox->addContainer($thb_container); $contents = thb_slideshow_contents(); $contents_taxonomies = array(); foreach ($contents as $post_type => $label) { if (!is_numeric($post_type)) { foreach (thb_get_post_type_taxonomies($post_type) as $tax) { $contents_taxonomies[] = $tax; } } } $thb_container = new THB_MetaboxFieldsContainer('', 'slideshow_contents_details_container'); $thb_field = new THB_QueryFilterField('slideshows_query'); $thb_field->setTaxonomies($contents_taxonomies); $thb_container->addField($thb_field); $thb_metabox->addContainer($thb_container); return $thb_metabox; }
function thb_add_blog_filter_metabox() { $thb_metabox = new THB_Metabox(__('Blog items', 'thb_text_domain'), 'loop'); $thb_metabox->setPriority('high'); $thb_container = $thb_metabox->createContainer('', 'loop_container'); $thb_field = new THB_QueryFilterField('post_query'); $thb_field->setTaxonomies(thb_get_post_type_taxonomies('post')); $thb_container->addField($thb_field); thb_theme()->getPostType('post')->addMetaboxToPages($thb_metabox); }