function thb_works_post_type() { /** * The post type labels. * * @see http://codex.wordpress.org/Function_Reference/register_post_type */ $thb_works_labels = array('name' => __('Portfolio', 'thb_text_domain'), 'singular_name' => __('Work', 'thb_text_domain'), 'add_new' => __('Add new', 'thb_text_domain'), 'add_new_item' => __('Add new Work', 'thb_text_domain'), 'edit' => __('Edit', 'thb_text_domain'), 'edit_item' => __('Edit Work', 'thb_text_domain'), 'new_item' => __('New Work', 'thb_text_domain'), 'view' => __('View Work', 'thb_text_domain'), 'view_item' => __('View Work', 'thb_text_domain'), 'search_items' => __('Search Works', 'thb_text_domain'), 'not_found' => __('No Works found', 'thb_text_domain'), 'not_found_in_trash' => __('No Works found in Trash', 'thb_text_domain'), 'parent' => __('Parent Work', 'thb_text_domain')); /** * The post type arguments. * * @see http://codex.wordpress.org/Function_Reference/register_post_type */ $options_slug = thb_get_option('works_url_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' => false, 'supports' => array('title', 'thumbnail', 'excerpt', 'editor', 'comments')); /** * Create the post type object. */ $thb_works = new THB_PostType('works', $thb_works_args); /** * Create the post type taxonomy for Works categories. */ $thb_works_taxonomy = new THB_Taxonomy("portfolio_categories", array('hierarchical' => true, 'label' => __('Portfolio Categories', 'thb_text_domain'), 'singular_label' => __('Portfolio Category', 'thb_text_domain'), 'rewrite' => true, 'query_var' => true)); $thb_works->addTaxonomy($thb_works_taxonomy); /** * Add the post type to the theme instance. */ $thb_theme = thb_theme(); $thb_theme->addPostType($thb_works); }
/** * Add a custom login logo. * * @return void */ public function customLoginLogo() { $login_logo = thb_get_option('login_logo'); if (empty($login_logo) || $login_logo['id'] == '') { return; } $url = thb_image_get_size($login_logo['id'], 'full'); $dimensions = @getimagesize($url); $background_size = 'auto'; if (0 >= $dimensions[1]) { $background_size = ''; $height = 67; } else { // $ratio = intval($dimensions[0]) / intval($dimensions[1]); // $height = 328 * (1 / $ratio); $height = intval($dimensions[1]); } echo '<style type="text/css"> .login h1 a { width: 328px; height: ' . intval($height) . 'px; margin: 0 auto; background-size: ' . $background_size . '; background-image: url("' . $url . '") !important; } </style>'; }
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_contact_map($params = array()) { $latlong = thb_get_option('contact_lat_long'); $zoom = thb_get_option("contact_zoom"); $marker = thb_get_option("contact_marker"); $map_config = array('height' => '500'); $map_config = thb_array_asum($map_config, $params); if ($latlong != '') { echo thb_do_shortcode("[thb_map latlong='{$latlong}' zoom='{$zoom}' " . thb_get_attributes($map_config) . " marker='{$marker}']"); } }
/** * The widget's editing form * * @see THB_Widget::form **/ public function widgetForm($instance) { $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'); } $this->formInputText('title', __('Title', 'thb_text_domain'), "<span style='color:red'>" . $config_note . "</span>", $instance); $this->formInputText('user', __('Screen name', 'thb_text_domain'), '', $instance); $this->formInputNumber('num', __('How many tweets?', 'thb_text_domain'), '', $instance); }
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); }
/** * 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); } }
function woocommerce_output_related_products() { $related_per_page = thb_get_option('related_products_per_page'); woocommerce_related_products($related_per_page, 4); }
function thb_featuredimagebackground() { $image_size = 'large'; if (function_exists('is_woocommerce') && is_shop()) { $image = thb_get_option('woocommerce_shop_pageheader_background_image'); thb_get_template_part('partial-featuredimage-background', array('featured_image' => thb_image_get_size($image['id'], $image_size), 'bg_opacity' => thb_get_option('woocommerce_shop_pageheader_background_opacity'))); } elseif (function_exists('is_woocommerce') && is_product_category()) { global $wp_query; $cat = $wp_query->get_queried_object(); $thumbnail_id = get_woocommerce_term_meta($cat->term_id, 'thumbnail_id', true); thb_get_template_part('partial-featuredimage-background', array('featured_image' => thb_image_get_size($thumbnail_id, $image_size), 'bg_opacity' => thb_get_option('woocommerce_shop_pageheader_background_opacity'))); } else { $page_id = thb_get_page_ID(); $is_dynamic_home = $page_id == 0 && is_front_page() && get_option('show_on_front') == 'posts'; $image = ''; $templates = array('default', 'single.php', 'single-product.php', 'single-works.php', 'template-archives.php', 'template-blog-classic.php', 'template-blog-stream.php', 'template-portfolio.php', 'template-contact.php', 'template-photogallery.php'); if ($page_id !== 0 && !is_singular('works') && !is_attachment()) { $image = thb_get_featured_image($page_id, $image_size); } if (thb_check_page_template($page_id, $templates) || thb_is_archive() || is_attachment()) { thb_get_template_part('partial-featuredimage-background', array('featured_image' => $image, 'bg_opacity' => thb_get_post_meta(thb_get_page_ID(), 'background_opacity'))); } } }
<?php /** * @package WordPress * @subpackage BigFoot * @since BigFoot 1.0 */ $footer_layout = thb_get_option('footer_layout'); if (empty($footer_layout)) { return; } $columns_classes = explode(',', $footer_layout); $columns_number = count($columns_classes); $display_footer = false; for ($i = 0; $i < $columns_number; $i++) { if (!$display_footer && is_active_sidebar('footer-sidebar-' . $i)) { $display_footer = true; } } if (!$display_footer) { return; } ?> <?php thb_footer_sidebar_before(); ?> <section id="page-footer" class="sidebar"> <?php thb_footer_sidebar_start();
function thb_woo_pageheader_body_classes($classes) { if (is_shop()) { $classes[] = 'pageheader-layout-' . thb_get_option('woocommerce_shop_pageheader_layout'); } if (is_woocommerce()) { $classes[] = thb_get_option('woocommerce_shop_pageheader_height'); } return $classes; }
<div class="thb-fields-container" id="thb-fields-container-<?php echo $fields_container->getSlug(); ?> "> <?php if ($fields_container->getTitle() != '') { ?> <h3 class="thb-fields-container-title"><?php echo $fields_container->getTitle(); ?> </h3> <?php } ?> <?php echo $container_intro_text; ?> <div class="thb-container"> <?php foreach ($fields_container->getFields() as $field) { $field->setValue(thb_get_option($field->getName())); $field->render(); } ?> </div> </div>
function thb_custom_css() { $custom_css = thb_get_option('custom_css'); if (!empty($custom_css)) { // thb_css_start(); echo $custom_css; // thb_css_end(); } }
/** * Append custom admin CSS. * * @return void */ public function appendCustomAdminCSS() { echo '<style type="text/css">' . thb_get_option('admin_css') . '</style>'; }
/** * @package WordPress * @subpackage BigFoot * @since BigFoot 1.0 * Template name: Contact */ /** * Send mail script */ thb_system_send_mail(thb_get_option('contact_email')); $thb_page_id = get_the_ID(); $subtitle = thb_get_post_meta($thb_page_id, 'subtitle'); $email = thb_get_option("contact_email"); $latlong = thb_get_option('contact_lat_long'); $zoom = thb_get_option("contact_zoom"); $contact_info = thb_duplicable_get('contact_info'); get_header(); ?> <!-- Page header --> <?php if (thb_get_post_meta($thb_page_id, 'pageheader_disable') == 0) { ?> <header class="pageheader"> <h1><?php the_title(); ?> </h1> <?php if (!empty($subtitle)) {
function thb_seo() { if (is_404()) { return; } if (!thb_get_option('seo_enable')) { return; } echo "<!-- SEO -->\n"; // SEO global data $url = is_front_page() ? home_url('/') : get_permalink(); $author = thb_get_option('seo_author'); $robots = thb_get_option('seo_robots'); $description = thb_get_option('seo_description'); $keywords = thb_get_option('seo_keywords'); $google_verification = thb_get_option('google_site_verification'); $title = is_front_page() ? get_bloginfo('name') : get_the_title(); $logo = thb_get_option('main_logo'); // Robots thb_meta('robots', $robots); // Author thb_meta('author', $author); // Description if (is_single() || is_page()) { $single_description = thb_get_post_meta(thb_get_page_ID(), 'seo_description'); if (!empty($single_description)) { $description = $single_description; } else { $post = get_post(thb_get_page_ID()); $description = thb_get_the_excerpt($post); } } thb_meta('description', $description); // Keywords if (is_single() || is_page()) { $single_keywords = thb_get_post_meta(thb_get_page_ID(), 'seo_keywords'); if (!empty($single_keywords)) { $keywords .= ', ' . $single_keywords; } } thb_meta('keywords', $keywords); // News keywords if (is_single()) { $tags = ''; $post_tags = get_the_tags(); if (!empty($post_tags)) { $i = 0; foreach (get_the_tags() as $tag) { $tags .= ($i == 0 ? '' : ',') . $tag->name; $i++; } thb_meta('news_keywords', $tags); } } // Google site verification thb_meta('google-site-verification', $google_verification); // Facebook Open Graph // See: http://developers.facebook.com/docs/opengraph/ echo "<!-- Open Graph -->\n"; thb_meta('og:locale', get_bloginfo('language')); thb_meta('og:url', $url); thb_meta('og:site_name', get_bloginfo('name')); if (!empty($logo)) { thb_meta('og:image', thb_image_get_size($logo['id'], 'full')); } thb_meta('og:title', $title); thb_meta('og:description', $description); thb_meta('og:type', is_single() ? 'article' : 'website'); }
if ($user == '') { return; } /** * Cache */ $cache_key = 'twitter_' . $user . '_' . $num; $cache = thb_cache_get($cache_key); if ($cache) { $tweets = $cache; } else { $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'); if ($consumer_key == '' || $consumer_secret == '' || $oauth_token == '' || $oauth_token_secret == '') { return; } $user = str_replace("@", "", $user); $connection = new TwitterOAuth($consumer_key, $consumer_secret, $oauth_token, $oauth_token_secret); $connection->host = "https://api.twitter.com/1.1/"; $tweets = $connection->get('statuses/user_timeline', array('screen_name' => $user, 'count' => $num)); if (in_array($connection->http_code, array('200', '304'))) { $tweets = thb_cache_set($cache_key, json_encode($tweets), 900); } else { $tweets = thb_cache_set($cache_key, FALSE, 600); } } $tweets = json_decode($tweets); ?>
$show = explode(',', $show); $services = array(); foreach ($show as $service_id) { $service_id = trim($service_id); if (in_array($service_id, $thb_services)) { $services[] = $service_id; } } } ?> <?php foreach ($services as $id) { ?> <?php $id = trim($id); $opt = thb_get_option('social_' . $id); $img = $thb_services_dataicon[$id]; $name = $thb_services_names[$id]; ?> <?php if ($opt != '') { ?> <a href="<?php echo $opt; ?> " title="<?php echo $name; ?> "> <span class="thb-social-icon"><?php
<?php thb_header_before(); ?> <header id="header"> <?php thb_header_start(); ?> <div class="header-container"> <div class="wrapper"> <?php $logo = thb_get_option('main_logo'); $logo_2x = thb_get_option('main_logo_retina'); if (!empty($logo['id']) && !empty($logo_2x['id'])) { ?> <?php $logo_metadata = wp_get_attachment_metadata($logo['id']); ?> <style> @media all and (-webkit-min-device-pixel-ratio: 1.5) { #logo { background-image: url('<?php echo thb_image_get_size($logo_2x['id'], 'full'); ?> '); background-size: <?php echo $logo_metadata['width']; ?>
function thb_show_pagination($post_type = null) { if (!$post_type) { global $post; $post_type = $post->post_type; } return thb_get_option($post_type . '_navigation') == 1; }
} ?> "> <p id="copyright"> <a id="footerlogo" href="<?php echo home_url('/'); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> " rel="home"><?php bloginfo('name'); ?> </a> <?php $copyright = thb_get_option("copyright"); if (!empty($copyright)) { ?> <span> — <?php echo thb_text_format($copyright); ?> </span> <?php } ?> </p> <a href="#" data-icon="u" class="gotop"></a> </div> </div> </section>
/** * Retrieve the page ID of the Portfolio index. * * @return integer */ function thb_portfolio_get_index() { $id = thb_get_option('portfolio_index'); $page = get_post($id); if (!$page) { $id = 0; } return $id; }
$thb_theme->setConfig('core/lightbox/submodules/magnific-popup', thb_array_asum($thb_config, $config)); $lightbox_enable = thb_config('core/lightbox/submodules/magnific-popup', 'options') == false || thb_get_option('enable_lightbox_images') == 1 || thb_get_option('enable_lightbox_videos') == 1; /** * Module scripts * ----------------------------------------------------------------------------- */ 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'));
/** * Fix for custom loop pagination in custom taxonomy archives. * * @param Request $request Page request * @return Request */ public function paginationFix($request) { if (!thb_array_contains($this->_type, array('post', 'page')) && $this->isPublicContent()) { $dummy_query = new WP_Query(); $dummy_query->parse_query($request); $thb_works_taxonomies = $this->getTaxonomies(); foreach ($thb_works_taxonomies as $tax) { if (isset($request[$tax->getType()])) { if ($dummy_query->is_front_page() || $dummy_query->is_archive()) { $posts_per_page = thb_get_option($this->getType() . '_per_page'); if (!empty($posts_per_page)) { $request["posts_per_page"] = $posts_per_page; } } } } } return $request; }