Пример #1
0
 function thb_works_slideshow_metabox()
 {
     $thb_theme = thb_theme();
     $thb_works = $thb_theme->getPostType('works');
     $thb_metabox = new THB_Metabox(__('Work images and videos', 'thb_text_domain'), 'portfolio_slides_config');
     $thb_metabox->setPriority('high');
     if (thb_config('core/portfolio', 'work_slides_config')) {
         $thb_metabox->addContainer(call_user_func(thb_config('core/portfolio', 'work_slides_config')));
     }
     $thb_metabox->addContainer(thb_create_slideshows_slides_container('', array('slides_key' => thb_config('core/portfolio', 'work_slides_key'))));
     $thb_works->addMetabox($thb_metabox);
 }
Пример #2
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;
 }