コード例 #1
0
ファイル: module.php プロジェクト: alfredpp/sarath-portfolio
 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 );
 }
コード例 #2
0
ファイル: options.php プロジェクト: joasssko/schk
/**
 * 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);
        }
    }
}
コード例 #3
0
ファイル: module.php プロジェクト: alfredpp/sarath-portfolio
 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);
 }