/** * Get the items from the duplicable table * * @return array */ public function getItems() { global $post; $post_id = isset($_GET['post']) ? $_GET['post'] : $post->ID; $items = thb_duplicable_get($this->getField()->getName(), $post_id); $fields = array(); $field = null; foreach ($items as $item) { $field = clone $this->_field; // if( $field->isComplex() ) { // $item['value'] = unserialize($item['value']); // } $meta = array(); if (!empty($item['meta'])) { $meta = $item['meta']; } $field->setValue($item['value']); $field->setMeta($meta); $fields[] = $field; } return $fields; }
<?php /** * @package WordPress * @subpackage BigFoot * @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
/** * Retrieve the collection items from duplicable slides. * * @return void */ protected function retrieveSlides() { if ($this->_id == 0) { return; } global $_wp_additional_image_sizes; $items = thb_duplicable_get($this->_key, $this->_id); foreach ($items as $item) { $type = isset($item['meta']['subtemplate']) && $item['meta']['subtemplate'] == 'add_image' ? 'image' : 'video'; $id = isset($item['value']['id']) ? $item['value']['id'] : 0; $url = isset($item['value']['url']) ? $item['value']['url'] : ''; $caption = isset($item['value']['caption']) ? $item['value']['caption'] : ''; if ($type == 'video' && thb_video_is_selfhosted($url)) { $type = 'video-selfhosted'; } $autoplay = isset($item['value']['autoplay']) ? $item['value']['autoplay'] : '0'; $loop = isset($item['value']['loop']) ? $item['value']['loop'] : '0'; $poster = ''; $orginal_poster_img = false; if ($type == 'image') { $thumb = thb_image_get_size($id, $this->_thumbSize); } else { $poster_width = $_wp_additional_image_sizes[$this->_thumbSize]['width']; $poster_height = $_wp_additional_image_sizes[$this->_thumbSize]['height']; $thumb = ''; $poster = $item['value']['poster']; if (!empty($poster)) { $orginal_poster_img = true; $thumb = thb_custom_resource('frontend/resizeImage'); $thumb .= '&id=' . $poster; $thumb .= '&w=' . $poster_width; $thumb .= '&h=' . $poster_height; } else { $thumb = thb_get_video_thumbnail($url, $this->_posterSize); $poster = $thumb; if (empty($thumb)) { $thumb = THB_ADMIN_CSS_URL . '/i/video.png'; } } } $this->_slides[] = array('post_id' => $this->_id, 'id' => $id, 'url' => $type == 'image' ? thb_image_get_size($id, $this->_size) : $url, 'full' => $type == 'image' ? thb_image_get_size($id, 'full') : $url, 'thumb' => $thumb, 'poster' => $poster, 'poster_custom' => $orginal_poster_img, 'caption' => $caption, 'type' => $type, 'autoplay' => $autoplay, 'loop' => $loop, 'link' => thb_image_get_size($id, 'full')); } }
/** * Register the theme sidebars. * * @return void */ private function registerSidebars() { $args = array('name' => '', 'id' => '', 'description' => '', 'class' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<header><h1 class="widgettitle">', 'after_title' => '</h1></header>'); // User-created sidebars foreach (thb_duplicable_get(THB_DUPLICABLE_SIDEBARS) as $sidebar) { $args['name'] = $sidebar['value']; $args['id'] = $sidebar['meta']['uniqid']; register_sidebar($args); } foreach ($this->_sidebars as $id => $name) { $args['name'] = $name; $args['id'] = $id; register_sidebar($args); } }
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; }
function thb_get_customfonts() { $custom_fonts = array(); $fonts = thb_duplicable_get('custom_font'); if (!empty($fonts)) { foreach ($fonts as $cfont) { $custom_fonts[$cfont['value']['css']] = array('family' => $cfont['value']['family'], 'variants' => $cfont['value']['variants'], 'type' => 'custom', 'folder' => $cfont['value']['folder']); } } return $custom_fonts; }
/** * @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)) { ?>