/** * Function to be run when migrating to a WordPress version after 3.6. * * - Post format adaptation: image, link, video, audio, quote * * @return void */ function thb_wp_migration_36() { $posts = get_posts(array('posts_per_page' => -1, 'post_status' => array('image', 'link', 'audio', 'video', 'quote'))); $posts = (array) $posts; if (count($posts) > 0) { foreach ($posts as $post) { $format = get_post_format($post->ID); switch ($format) { case 'image': $featured_image = thb_get_featured_image($post->ID); if (!empty($featured_image)) { update_post_meta($post->ID, '_format_image', $featured_image); // delete_post_meta($post->ID, '_thumbnail_id'); } break; case 'link': $link_url = thb_get_post_meta($post->ID, 'link_url'); if (!empty($link_url)) { update_post_meta($post->ID, '_format_link_url', $link_url); // delete_post_meta($post->ID, THB_META_KEY . 'link_url'); } break; case 'video': case 'audio': $url = thb_get_post_meta($post->ID, $format . '_url'); if (!empty($url)) { update_post_meta($post->ID, '_format_' . $format . '_embed', $url); // delete_post_meta($post->ID, THB_META_KEY . $format . '_url'); } break; case 'quote': $quote_text = thb_get_post_meta($post->ID, 'quote'); $quote_url = thb_get_post_meta($post->ID, 'quote_url'); $quote_url = str_replace('http://', '', $quote_url); $quote_author = thb_get_post_meta($post->ID, 'quote_author'); wp_update_post(array('ID' => $post->ID, 'post_content' => $quote_text)); update_post_meta($post->ID, '_format_quote_source_url', $quote_url); update_post_meta($post->ID, '_format_quote_source_name', $quote_author); // delete_post_meta($post->ID, THB_META_KEY . 'quote'); // delete_post_meta($post->ID, THB_META_KEY . 'quote_url'); // delete_post_meta($post->ID, THB_META_KEY . 'quote_author'); break; } wp_save_post_revision($post->ID); } } }
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; }
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; }
* @since BigFoot 1.0 */ $thb_page_id = get_the_ID(); $work_categories = wp_get_object_terms($thb_page_id, 'portfolio_categories'); $cats = array(); foreach ($work_categories as $cat) { $cats[] = $cat->name; } $prj_info = thb_duplicable_get('prj_info', $thb_page_id); $has_prj_info = !empty($prj_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($cats)) { ?> <h2><?php echo implode(', ', $cats); ?> </h2> <?php }
<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'); $btn_url = thb_get_post_meta($footer_stripe_id, 'footerstripes_call-to-action_btn_url'); echo '<div class="thb-call-to-container">'; if (!empty($big_text) || !empty($small_text)) { echo '<div class="thb-call-to-message">'; echo '<p class="thb-call-big-text">' . $big_text . '</p>'; echo '<p class="thb-call-small-text">' . nl2br($small_text) . '</p>'; echo '</div>'; if (!empty($btn_label) && !empty($btn_url)) { echo '<a class="btn" href="' . $btn_url . '">' . $btn_label . '</a>'; } } echo '</div>'; } ?> </div> </div>
<?php $author_description = get_the_author_meta('user_description'); if (!empty($author_description)) { ?> <div class="thb-text"> <?php echo thb_text_format($author_description, true); ?> </div> <?php } ?> </aside> <?php if (thb_get_post_meta($thb_page_id, 'disable_navigation_block') != '1') { ?> <?php thb_pagination(array('type' => 'links', 'previousPostTitle' => __('Previous', 'thb_text_domain'), 'nextPostTitle' => __('Next', 'thb_text_domain'))); ?> <?php } ?> <?php if (thb_show_related()) { ?> <section class="related"> <h3><?php _e('You might also like', 'thb_text_domain'); ?>
<?php $post_id = get_the_ID(); $post_layout = thb_get_post_meta($post_id, 'single_layout'); $video_url = thb_get_post_meta($post_id, 'video_url'); ?> <header class="item-header<?php if (!empty($video_url)) { ?> w-featured-image<?php } ?> "> <h1> <a href="<?php the_permalink(); ?> " rel="permalink"><?php the_title(); ?> </a> </h1> <footer class="item-footer"> <span class="author"><?php _e('Posted by', 'thb_text_domain'); ?> <?php the_author_posts_link(); ?> </span>
<?php $post_id = get_the_ID(); $post_layout = thb_get_post_meta($post_id, 'single_layout'); ?> <div class="item-content"> <?php if (get_the_excerpt() != '') { ?> <div class="text"> <?php the_content(); ?> </div> <?php } ?> </div>
<?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();
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); $offset = 0; if ($ajaxloading) { $total_slides = count($slides); $offset = isset($_GET['offset']) ? $_GET['offset'] : 0; $slides = array_slice($slides, $offset * $slides_per_page, $slides_per_page); } ?> <?php if (count($slides) > 0) { ?> <ul class="thb-photogallery-container" data-url="<?php echo add_query_arg('offset', $offset + 1); ?>
?> <div class="thb-twitter-livefeed"> <?php echo do_shortcode('[thb_twitter user="******" num="' . thb_get_post_meta($page_id, 'twitter_home_count') . '"]'); ?> </div> <?php } ?> <?php if (thb_get_post_meta($page_id, 'enable_social_home') == '1') { ?> <div class="thb-social-home"> <?php $thb_services = explode(',', thb_get_post_meta($page_id, 'social_home_services')); $thb_services_names = array('twitter' => 'Twitter', 'facebook' => 'Facebook', 'googleplus' => 'Google+', 'flickr' => 'Flickr', 'youtube' => 'YouTube', 'vimeo' => 'Vimeo', 'pinterest' => 'Pinterest', 'dribbble' => 'Dribbble', 'forrst' => 'Forrst', 'linkedin' => 'LinkedIn'); $thb_services_dataicon = array('twitter' => '1', 'facebook' => '2', 'googleplus' => '3', 'flickr' => '4', 'youtube' => '5', 'vimeo' => '6', 'pinterest' => '7', 'dribbble' => '8', 'forrst' => '9', 'linkedin' => 'v'); $services = $thb_services; if (!empty($show)) { $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
<?php $post_id = get_the_ID(); $post_layout = thb_get_post_meta($post_id, 'single_layout'); $link_url = thb_get_post_meta($post_id, 'link_url'); ?> <header class="item-header"> <h1> <a href="<?php the_permalink(); ?> " rel="permalink"><?php the_title(); ?> </a> </h1> <a class="linkurl" href="<?php echo $link_url; ?> " title="<?php the_title(); ?> "> <?php echo $link_url; ?> </a> <footer class="item-footer"> <span class="author"><?php _e('Posted by', 'thb_text_domain');
<?php $link_url = thb_get_post_meta(get_the_ID(), 'link_url'); ?> <a class="linkurl" href="<?php echo $link_url; ?> " title="<?php the_title(); ?> "> <?php echo $link_url; ?> </a> <div class="item-wrapper"> <header class="item-header"> <h1> <a href="<?php the_permalink(); ?> " rel="permalink"><?php the_title(); ?> </a> </h1> <time pubdate class="pubdate"> <?php echo get_the_date();
<?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>
if ($fields_container->getTitle() != '') { ?> <h4><?php echo $fields_container->getTitle(); ?> </h4> <?php } ?> <?php echo $container_intro_text; ?> <?php global $post; $post_id = isset($_GET['post']) ? $_GET['post'] : $post->ID; foreach ($fields_container->getFields() as $field) { if ($field->isComplex()) { $value = array(); foreach ($field->getSubkeys() as $subKey) { $value[$subKey] = thb_get_post_meta($post_id, $field->getName() . '_' . $subKey); } } else { $value = thb_get_post_meta($post_id, $field->getName()); } $field->setValue($value); $field->render(); } ?> </div>
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 $sizes = thb_get_post_meta(get_the_ID(), 'single_featured_size'); $post_featured_image = thb_get_post_thumbnail_src(get_the_ID(), $sizes); ?> <?php if (!empty($post_featured_image)) { ?> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> " class="item-thumb"> <span class="thb-overlay"></span> <img src="<?php echo $post_featured_image; ?> " alt=""> </a> <?php }
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'); }
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_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; }
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); } }
<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; ?> ;
<?php global $post; $gallery_instance = THB_Shortcode::$instance_number; $attr = array(); $output = ''; extract(array('order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'size' => $size, 'include' => '', 'exclude' => '')); $id = intval($id); if ('RAND' == $order) { $orderby = 'none'; } $attachments = array(); $gallery_shortcode = thb_get_post_meta($id, 'gallery_shortcode'); $pattern = '/ids="([^\\"]+)"/i'; preg_match_all($pattern, $gallery_shortcode, $matches, PREG_OFFSET_CAPTURE); if (isset($matches[1]) && !empty($matches[1])) { $attachments = explode(',', $matches[1][0][0]); array_walk($attachments, 'trim'); } else { return ''; } if (empty($attachments)) { return ''; } if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id) { $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; } return $output; }
<?php $video_url = thb_get_post_meta(get_the_ID(), 'video_url'); ?> <?php if (!empty($video_url)) { ?> <?php echo do_shortcode('[thb_video url="' . $video_url . '"]'); ?> <?php }
<?php echo get_the_date(); ?> </span> <span class="comments" data-icon="i"><a href="<?php comments_link(); ?> "><?php thb_comments_number(); ?> </a></span> </footer> </header> <?php $audio_url = thb_get_post_meta(get_the_ID(), 'audio_url'); ?> <?php if (!empty($audio_url)) { ?> <?php echo do_shortcode('[thb_audio src="' . $audio_url . '"]'); } ?> <div class="item-content"> <?php if (get_the_excerpt() != '') { ?> <div class="text">
function thb_get_post_format_video_url() { return thb_get_post_meta(get_the_ID(), 'video_url'); }
/** * Return the Portfolio item external URL. * * @param integer $id * @return string */ function thb_portfolio_item_get_external_url($id = null) { if (!$id) { $id = get_the_ID(); } $external_url = esc_url(thb_get_post_meta($id, 'external_url')); return $external_url; }
$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 the_title();
function listTablePicsColumnContent($column_name, $id) { if ($column_name == 'slides') { $slideshow = new THB_Slideshow($id); foreach ($slideshow->getSlides() as $slide) { $thumb = $slide['thumb']; echo '<img src="' . $thumb . '" alt="" class="list-thumb ' . $slide['type'] . '">'; } } elseif ($column_name == 'shortcode') { echo '<code>[thb_slideshow id="' . $id . '"]</code>'; } elseif ($column_name == 'type') { $types = thb_slideshows_types(); if (isset($types[thb_get_post_meta($id, 'slideshow_type')])) { echo $types[thb_get_post_meta($id, 'slideshow_type')]; } } }