Example #1
0
 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);
     }
 }
 /**
  * Constructor
  *
  */
 public function __construct()
 {
     $this->instance = thb_theme();
     $this->instance->getAdmin()->setInstallationDetails(array('updates' => array('last_check' => 0, 'latest_version' => 0, 'changelog' => '')), true);
     // Preserve original data
     $this->checkForUpdates();
 }
 function thb_save_option($key, $value)
 {
     $theme = thb_theme();
     $options = $theme->getOptions();
     $options[$key] = $value;
     update_option(THB_OPTIONS_KEY, $options);
 }
 /**
  * Constructor
  *
  * @param string $name The widget name.
  * @param string $label The widget label.
  * @param string $description The widget description.
  * @param string $shortcode The widget shortcode.
  */
 public function __construct($name, $label, $description, $shortcode)
 {
     parent::__construct($name, $label, array('description' => $description));
     $thb_theme = thb_theme();
     $this->_shortcode = $thb_theme->getShortcode($shortcode);
     $this->_description = $description;
 }
Example #5
0
 function thb_append_theme_customization()
 {
     thb_css_start('thb_theme_customization');
     thb_theme()->getCustomization()->render(true);
     // echo get_option(THB_CUSTOMIZATIONS);
     thb_custom_css();
     thb_css_end();
 }
Example #6
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);
     }
 }
Example #7
0
        /**
         * Render the control.
         *
         * @return void
         */
        public function render_content()
        {
            $thb_theme = thb_theme();
            $fonts = thb_get_fonts();
            ?>
			<label>
				<span class="customize-control-title"><?php 
            echo esc_html($this->label);
            ?>
</span>
				<select <?php 
            $this->link();
            ?>
 class="font-family">
					<?php 
            foreach ($fonts as $style => $families) {
                ?>
						<optgroup label="<?php 
                echo $style;
                ?>
">
							<?php 
                foreach ($families as $family => $font) {
                    ?>
								<?php 
                    if (is_array($font)) {
                        ?>
									<option value="<?php 
                        echo $family;
                        ?>
"><?php 
                        echo $font['family'];
                        ?>
</option>
								<?php 
                    }
                    ?>
							<?php 
                }
                ?>
						</optgroup>
					<?php 
            }
            ?>
				</select>
			</label>
			<?php 
        }
Example #8
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);
 }
Example #9
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') );
 }
Example #10
0
/**
 * Portfolio custom post type.
 *
 * ---
 *
 * The Happy Framework: WordPress Development Framework
 * Copyright 2012, Andrea Gandino & Simone Maranzana
 *
 * Licensed under The MIT License
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package THB Portfolio
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
function thb_portfolio_post_type()
{
    /**
     * The post type labels.
     *
     * @see http://codex.wordpress.org/Function_Reference/register_post_type
     */
    $thb_works_labels = array('name' => __('Portfolio', 'thb-portfolio'), 'singular_name' => __('Work', 'thb-portfolio'), 'add_new' => __('Add new', 'thb-portfolio'), 'add_new_item' => __('Add new Work', 'thb-portfolio'), 'edit' => __('Edit', 'thb-portfolio'), 'edit_item' => __('Edit Work', 'thb-portfolio'), 'new_item' => __('New Work', 'thb-portfolio'), 'view' => __('View Work', 'thb-portfolio'), 'view_item' => __('View Work', 'thb-portfolio'), 'search_items' => __('Search Works', 'thb-portfolio'), 'not_found' => __('No Works found', 'thb-portfolio'), 'not_found_in_trash' => __('No Works found in Trash', 'thb-portfolio'), 'parent' => __('Parent Work', 'thb-portfolio'));
    /**
     * The post type arguments.
     *
     * @see http://codex.wordpress.org/Function_Reference/register_post_type
     */
    if (thb_portfolio_framework_check()) {
        $options_slug = thb_get_option('works_url_slug');
    } else {
        $options_slug = apply_filters('thb_portfolio_slug', '');
    }
    $slug = !empty($options_slug) ? $options_slug : 'works';
    $thb_works_args = array('labels' => $thb_works_labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug' => $slug, 'with_front' => true), 'query_var' => true, 'show_in_nav_menus' => true, 'supports' => array('title', 'thumbnail', 'excerpt', 'editor', 'comments', 'custom-fields'));
    /**
     * Create the post type object.
     */
    register_post_type('works', $thb_works_args);
    if (thb_portfolio_framework_check()) {
        $thb_works = new THB_PostType('works', $thb_works_args);
    }
    /**
     * Create the post type taxonomy for Works categories.
     */
    $thb_portfolio_categories_args = array('hierarchical' => true, 'labels' => array('name' => __('Portfolio Categories', 'thb-portfolio'), 'singular_name' => __('Portfolio Category', 'thb-portfolio'), 'search_items' => __('Search Portfolio Categories', 'thb-portfolio'), 'all_items' => __('All Portfolio Categories', 'thb-portfolio'), 'parent_item' => __('Parent Portfolio Category', 'thb-portfolio'), 'parent_item_colon' => __('Parent Portfolio Category:', 'thb-portfolio'), 'edit_item' => __('Edit Portfolio Category', 'thb-portfolio'), 'update_item' => __('Update Portfolio Category', 'thb-portfolio'), 'add_new_item' => __('Add New Portfolio Category', 'thb-portfolio'), 'new_item_name' => __('New Portfolio Category Name', 'thb-portfolio'), 'menu_name' => __('Portfolio Category', 'thb-portfolio')), 'rewrite' => true, 'query_var' => true);
    register_taxonomy('portfolio_categories', 'works', $thb_portfolio_categories_args);
    if (thb_portfolio_framework_check()) {
        $thb_works_taxonomy = new THB_Taxonomy('portfolio_categories', $thb_portfolio_categories_args);
        $thb_works->addTaxonomy($thb_works_taxonomy);
    }
    /**
     * Add the post type to the theme instance.
     */
    if (thb_portfolio_framework_check()) {
        $thb_theme = thb_theme();
        $thb_theme->addPostType($thb_works);
    }
}
Example #11
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);
     }
 }
Example #12
0
                }
            }
        } else {
            if (!is_archive() && !is_search() && !is_404()) {
                if (is_active_sidebar('post-sidebar')) {
                    $classes[] = 'w-sidebar';
                }
            }
        }
        return $classes;
    }
    add_filter('body_class', 'sidebars_body_classes');
}
/**
 * Dynamic sidebars options
 * -----------------------------------------------------------------------------
 */
if (thb_config('core/sidebars', 'options')) {
    $thb_options_page = thb_theme()->getAdmin()->getMainPage();
    $thb_tab = new THB_Tab(__('Sidebars', 'thb_text_domain'), 'sidebars');
    $thb_options_page->addTab($thb_tab, 2);
    if (thb_config('core/sidebars', 'duplicable')) {
        $thb_tab = $thb_options_page->getTab('sidebars');
        $thb_container = $thb_tab->createDuplicableContainer(__('Sidebars', 'thb_text_domain'), 'sidebars');
        $thb_container->addControl(__('Add new sidebar', 'thb_text_domain'), '');
        $thb_container->setSortable();
        $thb_field = new THB_TextField(THB_DUPLICABLE_SIDEBARS);
        $thb_field->setLabel(__('Name', 'thb_text_domain'));
        $thb_container->setField($thb_field);
    }
}
Example #13
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);
 }
Example #14
0
 /**
  * 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);
         }
     }
 }
 function thb_woocommerce_extra_options()
 {
     $thb_theme = thb_theme();
     $thb_page = $thb_theme->getAdmin()->getMainPage();
     $thb_tab = $thb_page->getTab('woocommerce');
     $thb_container = $thb_tab->createContainer(__('Shop general options', 'thb_text_domain'), 'woocommerce_general_options');
     $thb_field = new THB_YesNoField('enable_shop_cart_allpages');
     $thb_field->setLabel(__('Enable shop cart on all pages', 'thb_text_domain'));
     $thb_field->setHelp(__('Choose if you want to enable the shop cart on header on all pages or only for "Shop" related pages.', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_container = $thb_tab->getContainer('woocommerce_shop_options');
     $thb_field = new THB_SelectField('woocommerce_shop_pageheader_layout');
     $thb_field->setLabel(__('Page header layout', '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('woocommerce_shop_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_field->setHelp(__('This setting will affect also the shop\'s archive and taxonomy pages.', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_UploadField('woocommerce_shop_pageheader_background_image');
     $thb_field->setLabel(__('Page header background image', 'thb_text_domain'));
     $thb_container->addField($thb_field);
     $thb_field = new THB_NumberField('woocommerce_shop_pageheader_background_opacity');
     $thb_field->setMin(0);
     $thb_field->setMax(1);
     $thb_field->setStep(0.05);
     $thb_field->setLabel(__('Page header background opacity', 'thb_text_domain'));
     $thb_container->addField($thb_field);
 }
 function thb_get_post_type_sidebar($post_type = null)
 {
     if (!empty($post_type)) {
         $thb_theme = thb_theme();
         $post_type = $thb_theme->getPostType($post_type);
         if ($post_type) {
             return $post_type->getSidebar();
         }
     }
     return '';
 }
Example #17
0
 function thb_single_layout_options()
 {
     $post_types = thb_theme()->getPostTypes();
     foreach ($post_types as $pt) {
         if ($pt->isPublicContent() || $pt->getType() == 'post' || $pt->getType() == 'page') {
             $thb_metabox = new THB_Metabox(__('Layout', 'thb_text_domain'), 'layout');
             $thb_metabox->setPriority('high');
             $thb_metabox->addContainer(thb_layout_global_options_container());
             $pt->addMetabox($thb_metabox);
         }
     }
 }
Example #18
0
/**
 * Sidebars
 * -----------------------------------------------------------------------------
 */
function thb_portfolio_sidebars()
{
    if (thb_portfolio_framework_check() && thb_portfolio_config('sidebars')) {
        $thb_theme = thb_theme();
        $thb_works = $thb_theme->getPostType('works');
        $thb_theme->addSidebar(__('Portfolio sidebar', 'thb-portfolio'), 'works-sidebar');
        $thb_works->setSidebar('works-sidebar');
    }
}
Example #19
0
/**
 * 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);
        }
    }
}
Example #20
0
 function thb_get_field_template()
 {
     $theme = thb_theme();
     if (isset($_POST['posttype'])) {
         $postType = $theme->getPostType($_POST['posttype']);
         $metabox = $postType->getMetabox($_POST['metabox']);
         $container = $metabox->getContainer($_POST['container']);
         $field = $container->getField();
     } else {
         $page = $theme->getAdmin()->getPage($_POST['page']);
         $tab = $page->getTab($_POST['tab']);
         $container = $tab->getContainer($_POST['container']);
         $field = $container->getField();
     }
     $field->reset();
     if (isset($_POST['subtemplate']) && !empty($_POST['subtemplate'])) {
         $field->setMetaKey('subtemplate', $_POST['subtemplate']);
     }
     $field->render();
     die;
 }
Example #21
0
 function thb_add_home_page_slides_metabox()
 {
     $thb_metabox = new THB_Metabox(__('Slides', 'thb_text_domain'), 'slides');
     $thb_container = $thb_metabox->createDuplicableContainer('', 'slides_container');
     $thb_container->setSortable();
     $thb_container->setIntroText(__("<strong>How to use</strong><br><br>Insert the post type ID in order to populate the slide with the post's featured image, excerpt, title and a button with a link to the single post page.<br>Alternatively, you can insert custom texts and button.<br><br>Please note that if you're using a post type ID, custom texts and background image will override the entry's content.", 'thb_text_domain'));
     $thb_container->addControl(__('Add', 'thb_text_domain'), '');
     $thb_upload = new THB_HomePageSlideField('home_page_slide');
     $thb_upload->setLabel(__('Home page slide', 'thb_text_domain'));
     $thb_container->setField($thb_upload);
     thb_theme()->getPostType('page')->addMetabox($thb_metabox, array('template-showcase.php'));
 }
 function thb_style()
 {
     thb_theme()->getFrontend()->addStyle(get_stylesheet_uri());
 }
Example #23
0
 * ---
 *
 * The Happy Framework: WordPress Development Framework
 * Copyright 2012, Andrea Gandino & Simone Maranzana
 *
 * Licensed under The MIT License
 * Redistribuitions of files must retain the above copyright notice.
 *
 * @package Core\Shortcodes
 * @author The Happy Bit <*****@*****.**>
 * @copyright Copyright 2012, Andrea Gandino & Simone Maranzana
 * @link http://
 * @since The Happy Framework v 1.0
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
$thb_theme = thb_theme();
/**
 * Flickr
 * -----------------------------------------------------------------------------
 */
$shortcode = new THB_Shortcode('thb_flickr', 'frontend/shortcodes/flickr');
$shortcode->setAttributes(array('id' => '', 'num' => 3, 'title' => ''));
$shortcode->setExample('[thb_flickr id="..." num="3"]');
$shortcode->setLabel(__('Flickr', 'thb_text_domain'));
$shortcode->setType(__('Social', 'thb_text_domain'));
$thb_theme->addShortcode($shortcode);
/**
 * Twitter
 * -----------------------------------------------------------------------------
 */
$shortcode = new THB_Shortcode('thb_twitter', 'frontend/shortcodes/twitter');
 function thb_translated_admin_resource($key)
 {
     $thb_theme = thb_theme();
     $thb_admin_language = $thb_theme->getAdmin()->getLanguage();
     $thb_admin_default_language = $thb_theme->getAdmin()->getDefaultLanguage();
     if (file_exists(THB_LANGUAGES_DIR . '/' . $thb_admin_language . '/admin/resources/' . $key . '.php')) {
         // $file = THB_LANGUAGES_DIR . '/' . $thb_admin_language . '/admin/resources/' . $key;
         $thb_valid_language = $thb_admin_language;
     } else {
         // $file = THB_LANGUAGES_DIR . '/' . $thb_admin_default_language . '/admin/resources/' . $key;
         $thb_valid_language = $thb_admin_default_language;
     }
     $file = $thb_valid_language . '/admin/resources/' . $key;
     if (file_exists(THB_THEME_TEMPLATES_DIR . '/languages/' . $file . '.php')) {
         $file = THB_THEME_TEMPLATES_DIR . '/languages/' . $file;
     } else {
         $file = THB_LANGUAGES_DIR . '/' . $file;
     }
     $resource = new THB_Template($file);
     return $resource->render(true);
 }
 function thb_load_admin_translation()
 {
     global $thb_lang;
     $thb_theme = thb_theme();
     $thb_admin = $thb_theme->getAdmin();
     $thb_admin_language = $thb_admin->getLanguage();
     $thb_admin_default_language = $thb_admin->getDefaultLanguage();
     // Strings translation
     $file = 'strings.php';
     $strings = THB_LANGUAGES_DIR . '/' . $thb_admin_language . '/' . $file;
     if (!file_exists($strings)) {
         $strings = THB_LANGUAGES_DIR . '/' . $thb_admin_default_language . '/' . $file;
     }
     include $strings;
     // JavaScript translation
     $file = 'strings.js';
     $strings = THB_LANGUAGES_DIR . '/' . $thb_admin_language . '/' . $file;
     $strings_url = THB_LANGUAGES_URL . '/' . $thb_admin_language . '/' . $file;
     if (!file_exists($strings)) {
         $strings = THB_LANGUAGES_DIR . '/' . $thb_admin_default_language . '/' . $file;
         $strings_url = THB_LANGUAGES_URL . '/' . $thb_admin_default_language . '/' . $file;
     }
     $thb_admin->addScript($strings_url);
 }
?>
</p>
		<?php 
if (is_child_theme()) {
    ?>
			<p><?php 
    _e('Parent theme version', 'thb_text_domain');
    ?>
 <?php 
    echo THB_PARENT_THEME_VERSION;
    ?>
</p>
		<?php 
}
?>
	</div>

	<?php 
echo thb_translated_admin_resource('messages/update');
?>

	<div class="thb-page-content">
		<?php 
$installationDetails = thb_theme()->getAdmin()->getInstallationDetails();
$changelog = $installationDetails['updates']['changelog'];
$theme_changelog = new THB_Template(THB_RESOURCES_DIR . '/admin/pages/thb_theme_changelog', array('changelog' => $changelog));
$theme_changelog->render();
?>
	</div>

</div>
Example #27
0
 function thb_save_tab()
 {
     thb_system_verify_nonce('THB_tab');
     $theme = thb_theme();
     $page = $theme->getAdmin()->getPage($_POST['page']);
     $tab = $page->getTab($_POST['tab']);
     $containers = $tab->getContainers();
     $uniqids = array();
     foreach ($containers as $container) {
         if (!$container->isDuplicable()) {
             $newoptions = array();
             foreach ($container->getFields() as $field) {
                 if ($field->isComplex()) {
                     $value = array();
                     foreach ($field->getSubkeys() as $subKey) {
                         $value[$subKey] = thb_text_toDB($_POST[$field->getName()][$subKey]);
                     }
                 } else {
                     $value = thb_text_toDB($_POST[$field->getName()]);
                 }
                 $newoptions[$field->getName()] = $value;
             }
             $theme->saveOptions($newoptions);
         } else {
             $uniqids[$container->getSlug()] = thb_duplicable_fields_save($container->getField());
         }
     }
     thb_system_raise_success(__('All saved!', 'thb_text_domain'), $uniqids);
 }
Example #28
0
 function thb_portfolio_script_and_styles()
 {
     $thb_theme = thb_theme();
     $thb_works = $thb_theme->getPostType('works');
     $conds = array('templates' => $thb_works->getPageTemplates());
     $thb_frontend = $thb_theme->getFrontend();
     $thb_frontend->addScript(THB_FRONTEND_JS_URL . '/jquery.isotope.min.js', $conds);
     $thb_frontend->addScript(thb_get_module_url('core/portfolio') . '/js/thb.portfolio.js', $conds);
     $thb_frontend->addScript(thb_get_module_url('core/portfolio') . '/js/config.js', $conds);
     $thb_frontend->addStyle(THB_FRONTEND_CSS_URL . '/isotope.css', $conds);
 }
 /**
  * Render the page.
  *
  * @return void
  */
 public function render()
 {
     $page_template = new THB_TemplateLoader($this->_template, array('page' => $this, 'theme' => thb_theme()));
     $page_template->render();
 }
Example #30
0
 function thb_get_post_types_for_select()
 {
     $thb_theme = thb_theme();
     $post_types = array();
     foreach ($thb_theme->getPostTypes() as $post_type) {
         $post_types[$post_type->getType()] = $post_type->getName();
     }
     return $post_types;
 }