function thb_add_sidebar_metabox() { $thb_theme = thb_theme(); // $thb_posts = $thb_theme->getPostType('post'); // $thb_pages = $thb_theme->getPostType('page'); // $thb_posts->addMetabox( thb_sidebars_metabox('post') ); foreach (thb_config('core/sidebars', 'templates') as $template) { if (thb_is_admin_template($template)) { $post_type = thb_get_post_type_from_template($template); $thb_metabox = $thb_theme->getPostType($post_type)->getMetabox('layout'); if ($thb_metabox) { $thb_metabox->addContainer(thb_sidebars_metabox_container($post_type)); } } } // $thb_pages->addMetaboxToPages( thb_sidebars_metabox(), thb_config('core/sidebars', 'templates') ); // $thb_pages->addMetabox( thb_sidebars_metabox(), thb_config('core/sidebars', 'templates') ); }
function thb_theme_layout_options() { global $page_templates, $single_post, $portfolio, $masonry, $page_layout_templates; $thb_container = new THB_MetaboxFieldsContainer('', 'extra_container'); $thb_field = new THB_SelectField('pageheader_layout'); $thb_field->setLabel(__('Page header alignment', 'thb_text_domain')); $thb_field->setOptions(array('left' => __('Left', 'thb_text_domain'), 'center' => __('Center', 'thb_text_domain'), 'right' => __('Right', 'thb_text_domain'))); $thb_container->addField($thb_field); $thb_field = new THB_SelectField('pageheader_height'); $thb_field->setLabel(__('Page header height', 'thb_text_domain')); $thb_field->setOptions(array('pageheader-big' => __('Large', 'thb_text_domain'), 'pageheader-compact' => __('Compact', 'thb_text_domain'))); $thb_container->addField($thb_field); $thb_field = new THB_ColorField('background_color'); $thb_field->setLabel(__('Background color', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('background_opacity'); $thb_field->setLabel(__('Background opacity', 'thb_text_domain')); $thb_field->setMin('0'); $thb_field->setMax('1'); $thb_field->setStep('0.05'); $thb_field->setDefault('0.85'); $thb_container->addField($thb_field); foreach ($page_layout_templates as $template) { if (thb_is_admin_template($template)) { $post_type = thb_theme()->getPostType(thb_get_post_type_from_template($template)); $post_type->getMetabox('layout')->addContainer($thb_container); } } }
/** * Add a Slideshow metabox to the specified page templates. * * @param array $templates The page templates. * @return void */ function thb_add_entry_slideshow_metabox($templates) { $thb_metabox = thb_create_entry_slideshow_metabox(); foreach ($templates as $template) { $post_type = thb_theme()->getPostType(thb_get_post_type_from_template($template)); if (thb_is_admin_template($template)) { $post_type->addMetabox($thb_metabox); } } }