function thb_seo_options_tab() { if (thb_is_super_user()) { $thb_page = thb_theme()->getAdmin()->getMainPage(); $thb_tab = new THB_Tab(__('SEO', 'thb_text_domain'), 'seo'); $thb_container = $thb_tab->createContainer('', 'seo_options'); $thb_field = new THB_CheckboxField('seo_enable'); $thb_field->setLabel(__('Enable SEO', 'thb_text_domain')); $thb_field->setHelp(__('This option will enable the search engines optimization component. If you mind to use an external plugin, you might want to disable it.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('seo_author'); $thb_field->setLabel(__('Site author', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('seo_description'); $thb_field->setLabel(__('Site description', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('seo_keywords'); $thb_field->setLabel(__('Keywords', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('seo_robots'); $thb_field->setLabel(__('Robots', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('google_site_verification'); $thb_field->setLabel(__('Google site verification', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); } }
function thb_backup_page() { $thb_theme = thb_theme(); $thb_page = new THB_BackupPage(__('Framework settings', 'thb_text_domain'), 'thb-framework_settings'); // General --------------------------------------------------------- $thb_tab = new THB_StaticTab(__('General', 'thb_text_domain'), 'general'); $thb_tab->setAction('thb_save_super_users'); $thb_tab->setSubmitLabel(__('Save changes', 'thb_text_domain')); $thb_container = $thb_tab->createContainer('', 'framework_settings_container'); $thb_field = new THB_TextField('thb_super_users'); $thb_field->setStaticOption('thb_super_users'); $thb_field->setLabel(__('Super users', 'thb_text_domain')); $thb_field->setHelp(sprintf(__('Enter a list of comma separated usernames to hide this page from other users. Can be reset from the <a href="%s">WP options page</a> under <code>thb_super_users</code>.', 'thb_text_domain'), admin_url('options.php'))); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); // Admin customizations -------------------------------------------- $thb_tab = new THB_Tab(__('Admin customizations', 'thb_text_domain'), 'thb_admin_customizations'); $thb_container = $thb_tab->createContainer('', 'admin_customizations'); $thb_field = new THB_UploadField('login_logo'); $thb_field->setLabel(__('Login logo', 'thb_text_domain')); $thb_field->setValue(thb_get_option('login_logo')); $thb_field->setHelp(__('Upload an image to be used as a logo in the login screen of your site. Please remember to load a properly dimensioned logo.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('admin_css'); $thb_field->setAllowCode(); $thb_field->setValue(thb_get_option('admin_css')); $thb_field->setLabel(__('Custom admin CSS', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_page->addTab($thb_tab); // Export options -------------------------------------------------- $thb_tab = new THB_StaticTab(__('Export', 'thb_text_domain'), 'export'); $thb_tab->setAction('thb_export'); $thb_tab->setSubmitLabel(__('Export', 'thb_text_domain')); $thb_container = $thb_tab->createContainer('', 'export_container'); $thb_container->setIntroText(__('Backup your duplicable content (slides, meta fields, etc.), options and customizations to the theme\'s appearance. Upon clicking on the Export button, the browser will prompt you to save a file with a <code>.thb-backup</code> extension which will contain your settings, encrypted.', 'thb_text_domain')); $thb_export_duplicable = new THB_CheckboxField('export_duplicable'); $thb_export_duplicable->setLabel(__('Export duplicable content', 'thb_text_domain')); $thb_export_duplicable->setValue('1'); $thb_container->addField($thb_export_duplicable); $thb_export_options = new THB_CheckboxField('export_options'); $thb_export_options->setLabel(__('Export options', 'thb_text_domain')); $thb_export_options->setValue('1'); $thb_container->addField($thb_export_options); $thb_export_skin = new THB_CheckboxField('export_mods'); $thb_export_skin->setLabel(__('Export skin', 'thb_text_domain')); $thb_export_skin->setValue('1'); $thb_container->addField($thb_export_skin); $thb_page->addTab($thb_tab); // Import options -------------------------------------------------- $thb_tab = new THB_StaticTab(__('Import', 'thb_text_domain'), 'import'); $thb_tab->setAction('thb_import'); $thb_tab->setSubmitLabel(__('Import', 'thb_text_domain')); $thb_container = $thb_tab->createContainer('', 'import_container'); $thb_container->setIntroText(__('Import a previously saved <code>.thb-backup</code> file. Please note that this will completely overwrite your options or skin settings.', 'thb_text_domain')); $thb_upload = new THB_ClassicUploadField('import_data'); $thb_upload->setLabel(__('Upload backup file', 'thb_text_domain')); $thb_container->addField($thb_upload); $thb_page->addTab($thb_tab); $thb_theme->getAdmin()->addPage($thb_page); }
function thb_layout_custom_css() { $thb_tab = thb_theme()->getAdmin()->getMainPage()->getTab('layout'); $thb_container = $thb_tab->createContainer(__('Customizations', 'thb_text_domain'), 'layout_options_customizations'); $thb_field = new THB_TextareaField('custom_css'); $thb_field->setAllowCode(); $thb_field->setLabel(__('Custom frontend CSS', 'thb_text_domain')); $thb_container->addField($thb_field); }
function thb_seo_init($post_type) { $thb_metabox = new THB_Metabox(__('SEO', 'thb_text_domain'), 'seo'); $thb_metabox->setPosition('side'); $thb_container = $thb_metabox->createContainer('', 'seo_container'); $thb_field = new THB_TextareaField('seo_description'); $thb_field->setLabel(__('Description', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('seo_keywords'); $thb_field->setLabel(__('Keywords', 'thb_text_domain')); $thb_container->addField($thb_field); $post_type->addMetabox($thb_metabox); }
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); }
function thb_add_footerstripes_posttype_config_metabox() { $consumer_key = thb_get_option('twitter_consumer_key'); $consumer_secret = thb_get_option('twitter_consumer_secret'); $oauth_token = thb_get_option('twitter_oauth_token'); $oauth_token_secret = thb_get_option('twitter_oauth_token_secret'); $config_note = ''; if ($consumer_key == '' || $consumer_secret == '' || $oauth_token == '' || $oauth_token_secret == '') { $config_note = __('Make sure to fill the required Twitter API settings in the "Theme options > Social" tab.', 'thb_text_domain'); } $post_type = thb_theme()->getPostType('footerstripes'); $thb_metabox = new THB_Metabox(__('Footer contents', 'thb_text_domain'), 'footerstripes_config'); $thb_container = $thb_metabox->createContainer('', 'footerstripes_config_container'); $thb_field = new THB_SelectField('footerstripes_content_type'); $thb_field->setLabel(__('Content type', 'thb_text_domain')); $thb_field->setOptions(array('twitter' => __('Twitter', 'thb_text_domain'), 'call-to-action' => __('Call to action', 'thb_text_domain'), 'social' => __('Social', 'thb_text_domain'))); $thb_container->addField($thb_field); // Twitter $thb_container = $thb_metabox->createContainer(__('Twitter', 'thb_text_domain'), 'footerstripes_content_type_twitter'); $thb_container->setIntroText($config_note); $thb_field = new THB_TextField('footerstripes_twitter_username'); $thb_field->setLabel(__('Username', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_NumberField('footerstripes_twitter_num'); $thb_field->setLabel(__('Tweets #', 'thb_text_domain')); $thb_container->addField($thb_field); // Social $thb_container = $thb_metabox->createContainer(__('Social', 'thb_text_domain'), 'footerstripes_content_type_social'); $thb_field = new THB_TextField('footerstripes_social_services'); $thb_field->setLabel(__('Services', 'thb_text_domain')); $thb_field->setHelp(__('Comma separated, order matters', 'thb_text_domain') . '. ' . __('Possible values', 'thb_text_domain') . ': twitter, facebook, googleplus, flickr, youtube, vimeo, pinterest, dribbble, forrst.'); $thb_container->addField($thb_field); // Call to action $thb_container = $thb_metabox->createContainer(__('Call to action', 'thb_text_domain'), 'footerstripes_content_type_call-to-action'); $thb_field = new THB_TextField('footerstripes_call-to-action_big_text'); $thb_field->setLabel(__('Big text', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('footerstripes_call-to-action_small_text'); $thb_field->setLabel(__('Small text', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('footerstripes_call-to-action_btn_text'); $thb_field->setLabel(__('Button text', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('footerstripes_call-to-action_btn_url'); $thb_field->setLabel(__('Button URL', 'thb_text_domain')); $thb_container->addField($thb_field); $post_type->addMetabox($thb_metabox); }
// Theme options page /** * General */ $thb_tab = $thb_page->getTab('general'); // General options $thb_container = $thb_tab->createContainer(__('General options', 'thb_text_domain'), 'general_options'); $thb_field = new THB_TextField('copyright'); $thb_field->setLabel(__('Copyright text', 'thb_text_domain')); $thb_field->setHelp(__('The copyright text will be displayed at the bottom of the site (Note: accepts basic HTML).', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextField('rss_alternate'); $thb_field->setLabel(__('Alternate RSS feed URL', 'thb_text_domain')); $thb_field->setHelp(__('If you want to use a custom feed service, like Feedburner or others, enter your preferred RSS feed URL. Otherwise the default WordPress RSS feed will be used.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_TextareaField('analytics'); $thb_field->setLabel(__('Google Analytics tracking code', 'thb_text_domain')); $thb_field->setHelp(sprintf(__('Paste your Google Analytics code here to enable statistics tracking for this site. For more info <a href="%s">read this article</a>.', 'thb_text_domain'), 'http://support.google.com/analytics/bin/answer.py?hl=en&topic=1006226&answer=1008080')); $thb_container->addField($thb_field); /** * Images */ $thb_tab = $thb_page->getTab('general_images'); $thb_container = $thb_tab->createContainer('', 'general_images_options'); $thb_field = new THB_UploadField('main_logo'); $thb_field->setLabel(__('Logo', 'thb_text_domain')); $thb_field->setHelp(__('Upload an image to be used as a logo for your site. If this field is left empty, a simple text logo will be used. Please remember to load a properly dimensioned logo.', 'thb_text_domain')); $thb_container->addField($thb_field); $thb_field = new THB_UploadField('main_logo_retina'); $thb_field->setLabel(__('Retina Logo', 'thb_text_domain')); $thb_field->setHelp(__('Upload an image to be used as a retina logo for your site. For retina upload a double size image.', 'thb_text_domain'));
/** * 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); } } }
case 'link': $thb_metabox = new THB_Metabox(__('Link', 'thb_text_domain'), $format); $thb_metabox->setPosition('thb_after_title'); $thb_metabox->setPriority('high'); $thb_container = $thb_metabox->createContainer('', 'post_' . $format . '_details'); $field = new THB_TextField('link_url'); $field->setLabel(__('URL', 'thb_text_domain')); $thb_container->addField($field); $thb_posts->addMetabox($thb_metabox); break; case 'quote': $thb_metabox = new THB_Metabox(__('Quote', 'thb_text_domain'), $format); $thb_metabox->setPosition('thb_after_title'); $thb_metabox->setPriority('high'); $thb_container = $thb_metabox->createContainer('', 'post_' . $format . '_details'); $field = new THB_TextareaField('quote'); $field->setLabel(__('Text', 'thb_text_domain')); $field->setHelp(__('This is where your quote text goes.', 'thb_text_domain')); $thb_container->addField($field); $field = new THB_TextField('quote_author'); $field->setLabel(__('Author', 'thb_text_domain')); $field->setHelp(__('Optional', 'thb_text_domain') . '.'); $thb_container->addField($field); $field = new THB_TextField('quote_url'); $field->setLabel(__('URL', 'thb_text_domain')); $field->setHelp(__('Optional', 'thb_text_domain') . '.'); $thb_container->addField($field); $thb_posts->addMetabox($thb_metabox); break; case 'audio': $thb_metabox = new THB_Metabox(__('Audio', 'thb_text_domain'), $format);