Exemplo n.º 1
0
 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);
         }
     }
 }
Exemplo n.º 2
0
 function thb_layout_body_classes($classes)
 {
     $id = thb_get_page_ID();
     if (thb_get_post_meta($id, 'page_boxed')) {
         $classes[] = 'thb-page-boxed';
     }
     if (thb_get_post_meta($id, 'pageheader_disable') == "1") {
         $classes[] = 'thb-pageheader-disabled';
     }
     if (thb_check_template_config('core/layout', 'meta_options_gutter')) {
         $classes[] = 'thb-gutter-' . thb_get_post_meta($id, 'gutter');
     }
     $classes[] = thb_get_option('logo_position');
     return $classes;
 }