示例#1
0
 function thb_add_footerstripe_metabox()
 {
     if (thb_is_admin_template(thb_config('footerstripe', 'templates'))) {
         $thb_metabox = thb_theme()->getPostType('page')->getMetabox('layout');
         $thb_container = $thb_metabox->createContainer(__('Footer stripe', 'thb_text_domain'), 'footerstripe_container');
         $thb_field = new THB_SelectField('footerstripe');
         $thb_field->setLabel(__('Select', 'thb_text_domain'));
         $thb_field->setDynamicOptions('thb_get_footerstripes_for_select');
         $thb_container->addField($thb_field);
     }
 }
示例#2
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;
 }
示例#3
0
$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)
    {
        if (is_woocommerce()) {
            $classes[] = 'thb-shop-' . thb_get_option('shop_columns') . 'col';
        }
        return $classes;
    }
    add_action('body_class', 'thb_shop_columns_layout');
示例#4
0
 /**
  * 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;
 }