コード例 #1
0
ファイル: module.php プロジェクト: alfredpp/sarath-portfolio
 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);
     }
 }
コード例 #2
0
 function thb_portfolio_add_work_details()
 {
     $thb_works = thb_theme()->getPostType('works');
     $thb_metabox = new THB_Metabox(__('Project details', 'thb_text_domain'), 'extra');
     $thb_metabox->setPriority('high');
     $work_details = thb_config('core/portfolio', 'work_details');
     if ($work_details == 'text') {
         $thb_container = $thb_metabox->createContainer('', 'details');
         $field = new THB_TextareaField('prj_info');
         $field->setHelp(__('Insert here your project details (Note: accepts basic HTML).', 'thb_text_domain'));
         $thb_container->addField($field);
     } elseif ($work_details == 'keyvalue') {
         $thb_container = $thb_metabox->createDuplicableContainer('', 'details');
         $thb_container->addControl(__('Add', 'thb_text_domain'), '');
         $thb_upload = new THB_KeyValueField('prj_info');
         $thb_upload->setLabel(__('Detail', 'thb_text_domain'));
         $thb_container->setField($thb_upload);
     }
     $thb_works->addMetabox($thb_metabox, array(), 0);
 }
コード例 #3
0
ファイル: config.php プロジェクト: alfredpp/sarath-portfolio
 function thb_add_home_page_slides_metabox()
 {
     $thb_metabox = new THB_Metabox(__('Slides', 'thb_text_domain'), 'slides');
     $thb_container = $thb_metabox->createDuplicableContainer('', 'slides_container');
     $thb_container->setSortable();
     $thb_container->setIntroText(__("<strong>How to use</strong><br><br>Insert the post type ID in order to populate the slide with the post's featured image, excerpt, title and a button with a link to the single post page.<br>Alternatively, you can insert custom texts and button.<br><br>Please note that if you're using a post type ID, custom texts and background image will override the entry's content.", 'thb_text_domain'));
     $thb_container->addControl(__('Add', 'thb_text_domain'), '');
     $thb_upload = new THB_HomePageSlideField('home_page_slide');
     $thb_upload->setLabel(__('Home page slide', 'thb_text_domain'));
     $thb_container->setField($thb_upload);
     thb_theme()->getPostType('page')->addMetabox($thb_metabox, array('template-showcase.php'));
 }