Beispiel #1
0
 function thb_add_footerstripe_metabox()
 {
     if (thb_is_admin_template(thb_config('footerstripe', 'templates'))) {
         $thb_metabox = thb_theme()->getPostType('page')->getMetabox('layout');
         $thb_container = $thb_metabox->createContainer(__('Footer stripe', 'thb_text_domain'), 'footerstripe_container');
         $thb_field = new THB_SelectField('footerstripe');
         $thb_field->setLabel(__('Select', 'thb_text_domain'));
         $thb_field->setDynamicOptions('thb_get_footerstripes_for_select');
         $thb_container->addField($thb_field);
     }
 }
Beispiel #2
0
 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') );
 }
Beispiel #3
0
 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 );
 }
Beispiel #4
0
 function thb_photogallery_container()
 {
     $thb_theme = thb_theme();
     $thb_photogallery_page_template = thb_config('core/photogallery', 'templates');
     if (thb_is_admin_template($thb_photogallery_page_template)) {
         $thb_metabox = new THB_Metabox(__('Gallery', 'thb_text_domain'), 'slideshow');
         $thb_container = $thb_metabox->createContainer(__('Configuration', 'thb_text_domain'), 'photogallery_masonry_details_container');
         $thb_field = new THB_NumberField('slides_per_page');
         $thb_field->setLabel(__('Pictures per page', 'thb_text_domain'));
         // $thb_field->setHelp( __('In case of AJAX loading, chose how many pictures to display.', 'thb_text_domain') );
         $thb_field->setHelp(__('Choose how many pictures to load dinamically. Leaving this empty will show all the images available.', 'thb_text_domain'));
         $thb_container->addField($thb_field);
         $thb_field = new THB_SelectField('portfolio_columns');
         $thb_field->setLabel(thb_config('core/photogallery', 'grid_templates_columns_label'));
         $thb_field->setOptions(thb_config('core/photogallery', 'grid_templates_columns'));
         $thb_container->addField($thb_field);
         $image_sizes = thb_config('core/photogallery', 'image_sizes');
         if (!empty($image_sizes)) {
             $slides_size_options = array();
             if (is_array(current($image_sizes))) {
                 $slides_size_options[] = __('Fixed', 'thb_text_domain');
                 $slides_size_options[] = __('Variable', 'thb_text_domain');
             } else {
                 $slides_size_options[$image_sizes[0]] = __('Fixed', 'thb_text_domain');
                 $slides_size_options[$image_sizes[1]] = __('Variable', 'thb_text_domain');
             }
             $thb_field = new THB_SelectField('slides_size');
             $thb_field->setLabel(__('Photos height', 'thb_text_domain'));
             $thb_field->setOptions($slides_size_options);
             $thb_container->addField($thb_field);
         }
         $thb_container = $thb_metabox->createDuplicableContainer(__('Photos', 'thb_text_domain'), 'photogallery_slides');
         $thb_container->setSortable();
         $thb_container->addControl(__('Add photo', 'thb_text_domain'), 'add_image', 'images.png', array('action' => 'thb_add_multiple_slides', 'title' => __('Add photos', 'thb_text_domain')));
         $field = new THB_SlideField('photogallery_slide');
         $field->setLabel(__('Slide', 'thb_text_domain'));
         $thb_container->setField($field);
         $thb_theme->getPostType('page')->addMetabox($thb_metabox);
     }
 }
Beispiel #5
0
 function sidebars_body_classes($classes)
 {
     $entry_id = thb_get_page_ID();
     if ($entry_id != 0) {
         $is_sidebar_page = in_array(thb_get_page_template($entry_id), thb_config('core/sidebars', 'templates')) || is_single();
         if ($is_sidebar_page) {
             $sidebar = thb_get_post_meta($entry_id, 'sidebar');
             if ($sidebar != '0' && is_active_sidebar($sidebar)) {
                 $classes[] = 'w-sidebar';
                 // Checking the sidebar position
                 $position = thb_get_post_meta($entry_id, 'sidebar_position');
                 $classes[] = $position;
             }
         }
     } else {
         if (!is_archive() && !is_search() && !is_404()) {
             if (is_active_sidebar('post-sidebar')) {
                 $classes[] = 'w-sidebar';
             }
         }
     }
     return $classes;
 }
Beispiel #6
0
/**
 * Module configuration
 * -----------------------------------------------------------------------------
 */
$thb_config = array('disable_core_skin' => false);
$thb_theme->setConfig('core/woocommerce', thb_array_asum($thb_config, $config));
/**
 * Theme customizations
 * -----------------------------------------------------------------------------
 */
if (file_exists(THB_TEMPLATE_DIR . '/woocommerce/theme-woocommerce.php')) {
    include THB_TEMPLATE_DIR . '/woocommerce/theme-woocommerce.php';
}
add_theme_support('woocommerce');
// Disable WooCommerce styles
if (thb_config('core/woocommerce', 'disable_core_skin')) {
    add_filter('woocommerce_enqueue_styles', '__return_empty_array');
}
/**
 * Woocommerce product page sidebar
 * -----------------------------------------------------------------------------
 */
/**
 * Theme options tab
 * -----------------------------------------------------------------------------
 */
$thb_page = $thb_theme->getAdmin()->getMainPage();
$thb_tab = new THB_Tab(__('WooCommerce', 'thb_text_domain'), 'woocommerce');
$thb_container = $thb_tab->createContainer(__('Shop page options', 'thb_text_domain'), 'woocommerce_shop_options');
$thb_field = new THB_SelectField('shop_columns');
$thb_field->setLabel(__('Columns layout', 'thb_text_domain'));
Beispiel #7
0
/**
 * Body classes
 * -----------------------------------------------------------------------------
 */
function thb_portfolio_body_classes($classes)
{
    if (!thb_portfolio_framework_check()) {
        return;
    }
    $thb_portfolio_grid_templates = thb_portfolio_config('grid_templates');
    $grid_body_class = thb_config('backpack/layout', 'grid_body_class');
    if ($grid_body_class && thb_is_page_template($thb_portfolio_grid_templates)) {
        $classes[] = thb_get_grid_class_name(thb_get_grid_columns());
    }
    return $classes;
}
Beispiel #8
0
/**
 * Display the contact form.
 *
 * @return void
 */
function thb_contact_form()
{
    thb_get_module_template_part('core/contact', 'contact-form', array('placeholder' => thb_config('core/contact', 'placeholder')));
}
Beispiel #9
0
 function thb_slideshow()
 {
     // $config = thb_config('core/slideshows');
     $page_id = thb_get_page_ID();
     $slideshow_shortcode = thb_get_post_meta($page_id, 'slideshow');
     if (empty($slideshow_shortcode)) {
         return;
     }
     if (thb_text_contains($slideshow_shortcode, 'thb_')) {
         $slideshow_id = thb_get_shortcode_attribute($slideshow_shortcode, 'id');
         $thb_slideshow = new THB_Slideshow($slideshow_id);
         $slideshow_type = $thb_slideshow->getType();
         if (thb_is_page_template(thb_config('core/slideshows/submodules/' . $slideshow_type, 'templates'))) {
             if (!empty($slideshow_shortcode) && trim($slideshow_shortcode) != '') {
                 echo thb_do_shortcode($slideshow_shortcode);
             }
         }
     } else {
         echo thb_do_shortcode($slideshow_shortcode);
     }
 }
 /**
  * Check if a particular key is currently enabled or disabled, or if it is
  * enabled only for a specific set of page templates.
  *
  * @param string $key The option key.
  * @param string $subkey The option subkey.
  * @return boolean
  */
 function thb_check_template_config($key, $subkey)
 {
     return thb_config($key, $subkey) === true || thb_is_admin_template(thb_config($key, $subkey));
 }
Beispiel #11
0
<?php

if (empty($id)) {
    $id = 0;
}
$slideshow_type = thb_get_post_meta($id, 'slideshow_type');
$slideshow_path = thb_get_module_path('core/slideshows/submodules/' . $slideshow_type);
$slideshow = new THB_Slideshow($id);
$slideshow->setBaseTemplate($slideshow_path . '/templates');
$slideshow->setSize(thb_config('core/slideshows/submodules/' . $slideshow_type, 'image_size'));
$slideshow->setMarkupId($markup_id);
$slideshow->render();
<?php

$thb_page_id = thb_get_page_ID();
$image_sizes = thb_config('core/photogallery', 'image_sizes');
$image_size = thb_config('core/photogallery', 'image_size');
$item_thumb_rel = thb_config('core/photogallery', 'item_thumb_rel');
$slideshow = new THB_Slideshow($thb_page_id, 'photogallery_slide');
if ($image_sizes != '') {
    $slides_size = thb_get_post_meta($thb_page_id, 'slides_size');
    if (is_array(current($image_sizes))) {
        $columns = thb_get_post_meta($thb_page_id, 'portfolio_columns');
        if (isset($image_sizes[$columns])) {
            $slideshow->setSize($image_sizes[$columns][$slides_size]);
        } else {
            reset($image_sizes);
            $image_size = current($image_sizes);
            if (isset($image_size[$slides_size])) {
                $slideshow->setSize($image_size[$slides_size]);
            } else {
                $slideshow->setSize($image_size);
            }
        }
    } else {
        $slideshow->setSize($slides_size);
    }
} else {
    $slideshow->setSize($image_size);
}
$slides = $slideshow->getSlides();
$slides_per_page = thb_get_post_meta($thb_page_id, 'slides_per_page');
$ajaxloading = !empty($slides_per_page);
Beispiel #13
0
 function thb_layout_global_options_container()
 {
     $thb_container = new THB_MetaboxFieldsContainer('', 'layout_container');
     if (thb_check_template_config('core/layout', 'meta_options_subtitle')) {
         if (!empty($_POST) || !thb_text_startsWith(thb_get_admin_template(), 'single')) {
             $field = new THB_TextField('subtitle');
             $field->setLabel(__('Page subtitle', 'thb_text_domain'));
             $thb_container->addField($field);
         }
     }
     if (thb_check_template_config('core/layout', 'meta_options_pageheader_disable')) {
         $field = new THB_CheckBoxField('pageheader_disable');
         $field->setDefault(false);
         $field->setLabel(__('Disable page header', 'thb_text_domain'));
         $thb_container->addField($field);
     }
     if (thb_check_template_config('core/layout', 'meta_options_page_boxed')) {
         $field = new THB_CheckBoxField('page_boxed');
         $field->setDefault(false);
         $field->setLabel(__('Box the page content and sidebar', 'thb_text_domain'));
         $field->setHelp(__('Checking this option, the page content and sidebar will both have a color background.', 'thb_text_domain'));
         $thb_container->addField($field);
     }
     if (thb_check_template_config('core/layout', 'meta_options_gutter')) {
         $thb_field = new THB_YesNoField('gutter');
         $thb_field->setDefault(thb_config('core/layout', 'meta_options_gutter_default'));
         $thb_field->setLabel(__('Gutter', 'thb_text_domain'));
         $thb_container->addField($thb_field);
     }
     return $thb_container;
 }
Beispiel #14
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);
 }
Beispiel #15
0
 function thb_portfolio_get_image_size()
 {
     $thb_page_id = thb_get_page_ID();
     $image_sizes = thb_config('core/portfolio', 'grid_image_sizes');
     $slides_size = thb_get_post_meta($thb_page_id, 'portfolio_grid_image_sizes');
     if ($slides_size != '') {
         if (is_array(current($image_sizes))) {
             $columns = thb_get_post_meta($thb_page_id, 'portfolio_columns');
             if (isset($image_sizes[$columns])) {
                 return $image_sizes[$columns][$slides_size];
             } else {
                 reset($image_sizes);
                 $image_size = current($image_sizes);
                 return $image_size[$slides_size];
             }
         }
     } else {
         return 'large';
     }
 }
Beispiel #16
0
if ($lightbox_enable) {
    $thb_lightbox = thb_get_module_url('core/lightbox/submodules/magnific-popup');
    if (thb_config('core/lightbox/submodules/magnific-popup', 'skin') == false) {
        $thb_theme->getFrontend()->addStyle($thb_lightbox . '/css/magnific-popup.css');
    }
    $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/jquery.magnific-popup.min.js');
    if (thb_get_option('enable_lightbox_images') == 1) {
        $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.config_images.js');
    }
    if (thb_get_option('enable_lightbox_videos') == 1) {
        $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.config_videos.js');
    }
    $thb_theme->getFrontend()->addScript($thb_lightbox . '/js/thb.lightbox.js');
}
/**
 * Theme options tab
 * -----------------------------------------------------------------------------
 */
if (thb_config('core/lightbox/submodules/magnific-popup', 'options')) {
    $thb_page = $thb_theme->getAdmin()->getMainPage();
    $thb_tab = new THB_Tab(__('Lightbox', 'thb_text_domain'), 'lightbox');
    $thb_container = $thb_tab->createContainer('', 'lightbox_options');
    $thb_container->setIntroText(__('Powered by Magnific Popup. If you mind to use another plugin, you might want to disable this feature.', 'thb_text_domain'));
    $thb_field = new THB_CheckboxField('enable_lightbox_images');
    $thb_field->setLabel(__('Enable lightbox for images', 'thb_text_domain'));
    $thb_container->addField($thb_field);
    $thb_field = new THB_CheckboxField('enable_lightbox_videos');
    $thb_field->setLabel(__('Enable lightbox for links to video pages and files', 'thb_text_domain'));
    $thb_container->addField($thb_field);
    $thb_page->addTab($thb_tab);
}
Beispiel #17
0
 function thb_flexslider_scripts_and_styles()
 {
     $config = thb_config('core/slideshows');
     $thb_flex = thb_get_module_url('core/slideshows/submodules/flexslider');
     thb_theme()->getFrontend()->addScript($thb_flex . '/js/config.js', array('templates' => $config['templates']));
     thb_theme()->getFrontend()->addScript($thb_flex . '/js/thb.slideshows_flexslider.js', array('templates' => $config['templates']));
 }