function thb_get_page_sidebar($page_id = null)
 {
     if (!$page_id) {
         $page_id = thb_get_page_ID();
     }
     $sidebar = thb_get_post_meta($page_id, 'sidebar');
     return $sidebar;
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
<script type="text/javascript" src="<?php 
echo THB_FRONTEND_JS_URL;
?>
/jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php 
echo THB_FRONTEND_JS_URL;
?>
/jquery.form.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {
		$('.thb-contact-form').thb_validate();
	});
</script>

<form class="thb-contact-form" method="post" action="<?php 
echo get_permalink(thb_get_page_ID());
?>
">
	<?php 
wp_nonce_field('thb_system_send_mail', 'thb_system_send_mail_nonce');
?>

	<span id="thb-contact-form-name">
		<label for="contact_name"><?php 
_e('Your name', 'thb_text_domain');
?>
</label>
		<?php 
$pl_a = '';
if ($placeholder) {
    $pl_a = 'placeholder="' . __('Your name', 'thb_text_domain') . '"';
		<div class="thb-featuredimage-background-container">
			<img src="" data-src="<?php 
    echo $featured_image;
    ?>
" alt="">
		</div>
	<?php 
}
?>

	<div class="thb-featuredimage-background-overlay"></div>
</div>

<style type="text/css">
	<?php 
$bg_color = thb_get_post_meta(thb_get_page_ID(), 'background_color');
if ($featured_image == '') {
    $bg_opacity = '1';
}
if ($bg_opacity == '') {
    $bg_opacity = '0.85';
}
?>
	#thb-featuredimage-background .thb-featuredimage-background-overlay {
		<?php 
if ($bg_color != '') {
    ?>
			background: <?php 
    echo $bg_color;
    ?>
;
Esempio n. 5
0
			<li class="filter <?php 
    echo $filter_all_class;
    ?>
" data-filter="" data-href="<?php 
    echo get_permalink(thb_get_page_ID());
    ?>
">
				<?php 
    echo __('All', 'thb-portfolio');
    ?>
			</li>
			<?php 
    foreach ($terms as $term) {
        ?>
				<?php 
        $link = add_query_arg('filter', 'portfolio_categories:' . $term->term_id, get_permalink(thb_get_page_ID()));
        $term_class = in_array($term->term_id, thb_portfolio_get_applied_filter_term_ids($args)) ? $filter_active_class : '';
        ?>
				<li class="filter <?php 
        echo $term_class;
        ?>
" data-filter="<?php 
        echo $term->term_id;
        ?>
" data-href="<?php 
        echo $link;
        ?>
">
					<?php 
        echo $term->name;
        ?>
Esempio n. 6
0
 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');
 }
Esempio n. 7
0
 function thb_layout_body_classes($classes)
 {
     $id = thb_get_page_ID();
     if (thb_get_post_meta($id, 'page_boxed')) {
         $classes[] = 'thb-page-boxed';
     }
     if (thb_get_post_meta($id, 'pageheader_disable') == "1") {
         $classes[] = 'thb-pageheader-disabled';
     }
     if (thb_check_template_config('core/layout', 'meta_options_gutter')) {
         $classes[] = 'thb-gutter-' . thb_get_post_meta($id, 'gutter');
     }
     $classes[] = thb_get_option('logo_position');
     return $classes;
 }
Esempio n. 8
0
<?php

$thb_page_id = thb_get_page_ID();
thb_post_query();
?>

<?php 
if (have_posts()) {
    $i = 1;
    while (have_posts()) {
        the_post();
        ?>
	<?php 
        thb_post_before();
        ?>
	<?php 
        $post_id = get_the_ID();
        $post_classes = thb_get_post_classes($i, array('item list'), 2);
        $post_classes[] = 'classic';
        ?>

	<div id="post-<?php 
        echo $post_id;
        ?>
" <?php 
        post_class($post_classes);
        ?>
>
		<?php 
        thb_post_start();
        ?>
Esempio n. 9
0
 function thb_related_posts_query()
 {
     $post_id = thb_get_page_ID();
     $post = get_post($post_id);
     $taxonomies = get_taxonomies(array('object_type' => array($post->post_type)));
     $args['post__not_in'] = array($post_id);
     $args['post_type'] = $post->post_type;
     $tax_query = array();
     $tax_query['relation'] = 'OR';
     foreach ($taxonomies as $key => $name) {
         $terms = wp_get_post_terms($post_id, $key, array('fields' => 'ids'));
         if (!empty($terms)) {
             $tax_query[] = array('taxonomy' => $key, 'field' => 'id', 'terms' => $terms, 'operator' => 'IN');
         }
     }
     $args['tax_query'] = $tax_query;
     return $args;
 }
Esempio n. 10
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);
     }
 }
Esempio n. 11
0
 function thb_system_loginout()
 {
     if (!empty($_POST) && isset($_POST['action']) && in_array($_POST['action'], array('login', 'logout'))) {
         $action = $_POST['action'];
         $redirect = false;
         switch ($action) {
             case 'login':
                 $creds = array();
                 $creds['user_login'] = $_POST['user_login'];
                 $creds['user_password'] = $_POST['user_password'];
                 $user = wp_signon($creds, false);
                 if (!$user instanceof WP_error) {
                     $redirect = true;
                 }
                 break;
             case 'logout':
                 wp_logout();
                 $redirect = true;
                 break;
             default:
                 die;
                 $redirect = true;
         }
         if ($redirect) {
             header('Location: ' . get_post_permalink(thb_get_page_ID()));
         }
     }
 }
Esempio n. 12
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';
     }
 }
 function thb_child_teme_bodyclasses_filter($classes)
 {
     global $thb_child_theme_bodyclasses;
     $id = thb_get_page_ID();
     if ($thb_child_theme_bodyclasses && !empty($thb_child_theme_bodyclasses)) {
         foreach ($thb_child_theme_bodyclasses as $bc) {
             if ($id == $bc['id']) {
                 if (!empty($bc['remove'])) {
                     thb_array_remove($classes, $bc['remove']);
                 }
                 $classes[] = $bc['add'];
             } else {
                 continue;
             }
         }
     }
     return $classes;
 }
Esempio n. 14
0
<?php 
$thb_pagination_config = array('type' => 'links', 'id' => 'thb-portfolio-pagination');
if (isset($previousText)) {
    $thb_pagination_config['previousText'] = $previousText;
}
if (isset($nextText)) {
    $thb_pagination_config['nextText'] = $nextText;
}
if (isset($arrowPreviousText)) {
    $thb_pagination_config['arrowPreviousText'] = $arrowPreviousText;
}
if (isset($arrowNextText)) {
    $thb_pagination_config['arrowNextText'] = $arrowNextText;
}
thb_pagination($thb_pagination_config);
?>

<script type="text/javascript">

	jQuery(document).ready(function($) {

		$.thb.config.set('portfolio', $.thb.config.defaultKeyName, {
			useAJAX: <?php 
echo (int) thb_get_post_meta(thb_get_page_ID(), 'works_ajax_pagination');
?>
		});

	});

</script>
Esempio n. 15
0
<?php

$footer_stripe_id = thb_get_post_meta(thb_get_page_ID(), 'footerstripe');
?>
				</div><!-- /.wrapper -->
				<?php 
thb_content_end();
?>
			</section><!-- /#content -->
			<?php 
thb_content_after();
?>

			<?php 
if (!empty($footer_stripe_id)) {
    ?>
			<div id="footer-stripe">
				<div class="wrapper">
					<div class="thb-footer-stripe-content">
						<?php 
    $content_type = thb_get_post_meta($footer_stripe_id, 'footerstripes_content_type');
    if ($content_type == 'social') {
        echo do_shortcode('[thb_social show="' . thb_get_post_meta($footer_stripe_id, 'footerstripes_social_services') . '"]');
    } elseif ($content_type == 'twitter') {
        echo '<div class="thb-twitter-livefeed">';
        echo do_shortcode('[thb_twitter user="******" num="' . thb_get_post_meta($footer_stripe_id, 'footerstripes_twitter_num') . '"]');
        echo '</div>';
    } elseif ($content_type == 'call-to-action') {
        $big_text = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_big_text');
        $small_text = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_small_text');
        $btn_label = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_btn_text');
Esempio n. 16
0
/**
 * Read the modal configuration and make them available for the Javascript side of things.
 *
 * @param array $params The portfolio loop parameters.
 */
function thb_portfolio_data_attributes($params = array())
{
    if (!thb_portfolio_framework_check()) {
        return;
    }
    $params = wp_parse_args($params, array('ajax_pagination' => (int) thb_get_post_meta(get_the_ID(), 'works_ajax_pagination')));
    $data = array('ajax' => (int) isset($params['ajax_pagination']) ? $params['ajax_pagination'] : 0, 'base' => get_permalink(thb_get_page_ID()));
    thb_data_attributes($data);
}
Esempio n. 17
0
 function thb_get_home_slides()
 {
     $home_slides_raw = thb_duplicable_get('home_page_slide', thb_get_page_ID());
     $home_slides = array();
     $image_size = 'large';
     $i = 0;
     foreach ($home_slides_raw as $slide) {
         $slide = $slide['value'];
         $home_slide = (object) array();
         $home_slide->index = $i;
         $home_slide->big_text = '';
         $home_slide->small_text = '';
         $home_slide->btn_url = '';
         $home_slide->btn_text = '';
         $home_slide->bg_picture = '';
         $home_slide->bg_color = '';
         $home_slide->bg_opacity = '0';
         $home_slide->class = '';
         $home_slide->post_id = $slide['post_id'];
         if (!empty($home_slide->post_id)) {
             $post = get_post($home_slide->post_id);
             if ($post) {
                 $home_slide->big_text = $post->post_title;
                 $home_slide->small_text = $post->post_excerpt;
                 $home_slide->btn_url = get_permalink($home_slide->post_id);
                 $home_slide->btn_text = __('More', 'thb_text_domain');
                 $home_slide->bg_picture = thb_get_featured_image($home_slide->post_id, $image_size);
             }
         }
         if (!empty($slide['big_text'])) {
             $home_slide->big_text = $slide['big_text'];
         }
         if (!empty($slide['small_text'])) {
             $home_slide->small_text = $slide['small_text'];
         }
         if (!empty($slide['btn_url'])) {
             $home_slide->btn_url = $slide['btn_url'];
         }
         if (!empty($slide['btn_text'])) {
             $home_slide->btn_text = $slide['btn_text'];
         }
         if (!empty($slide['id'])) {
             $home_slide->bg_picture = thb_image_get_size($slide['id'], $image_size);
         }
         $home_slide->bg_color = $slide['bg_color'];
         $home_slide->bg_opacity = $slide['bg_opacity'];
         $is_valid_solid_background = $home_slide->bg_color != '';
         if ($home_slide->bg_picture == '') {
             $home_slide->bg_opacity = 1;
         }
         if (!empty($slide['class'])) {
             $home_slide->class = $slide['class'];
         }
         $home_slides[] = $home_slide;
         $i++;
     }
     return $home_slides;
 }
<?php

$post_id = thb_get_page_ID();
$post_layout = thb_get_post_meta($post_id, 'single_layout');
$image_size = '';
if ($post_id) {
    $is_sidebar = thb_is_page_sidebar_active();
} else {
    $is_sidebar = function_exists('dynamic_sidebar') && is_active_sidebar('post-sidebar');
}
if ($is_sidebar) {
    $image_size = 'thumb-760-cropped';
} else {
    $image_size = 'large-cropped';
}
$post_featured_image = thb_get_featured_image(get_the_ID(), $image_size);
$post_gallery = thb_get_post_meta(get_the_ID(), 'gallery_shortcode');
?>

<header class="item-header<?php 
if (!empty($post_gallery)) {
    ?>
 w-featured-image<?php 
}
?>
">
	<h1>
		<a href="<?php 
the_permalink();
?>
" rel="permalink"><?php 
Esempio n. 19
0
 /**
  * Enqueue the theme styles.
  *
  * @return void
  */
 public function enqueueStyles()
 {
     global $wp_version;
     if (!empty($this->_styles['compressed'])) {
         $deps = array();
         foreach ($this->_styles['compressed'] as $style) {
             foreach ($style['deps'] as $dep) {
                 if (!in_array($dep, $deps) && !$this->isCompressedStyle($dep)) {
                     $deps[] = $dep;
                 }
             }
         }
         $src = thb_custom_resource('frontend/compressStyles');
         wp_enqueue_style('thb_compressed_styles', $src, $deps, $wp_version);
     }
     $i = 0;
     foreach ($this->_styles['not_compressed'] as $style) {
         if (is_array($style)) {
             extract($style);
             $page_id = thb_get_page_ID();
             if (empty($name)) {
                 $name = 'thb_uncompressed_' . $i;
             }
             if (!empty($templates)) {
                 foreach ($templates as $template) {
                     if (thb_check_page_template($page_id, $template)) {
                         wp_enqueue_style($name, $path, $deps, $wp_version, $media);
                         break;
                     }
                 }
             } else {
                 wp_enqueue_style($name, $path, $deps, $wp_version, $media);
             }
         }
         $i++;
     }
 }