/** * 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>'; }
<?php } ?> <h1 id="logo"> <a href="<?php echo home_url(); ?> " title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?> "> <?php if (isset($logo['id']) && $logo['id'] != '') { ?> <img src="<?php echo thb_image_get_size($logo['id'], 'full'); ?> " alt=""> <?php } else { ?> <?php bloginfo('name'); ?> <?php } ?> </a> </h1> <?php
<?php $id = $_GET['id']; $width = $_GET['w']; $height = $_GET['h']; $mime_type = get_post_mime_type($id); $image_url = thb_image_get_size($id, array($width, $height)); $res = thb_read_url($image_url); if (!empty($res)) { switch ($mime_type) { case 'image/jpeg': header('Content-Type: image/jpeg'); case 'image/png': header('Content-Type: image/png'); case 'image/gif': header('Content-Type: image/gif'); } echo $res; } else { header('Content-Type: image/jpeg'); echo ''; }
/** * Retrieve the collection items from a specific post type. * * @return void */ protected function retrievePostSlides() { $args = thb_post_type_query_args('slideshows', $this->_id); /** * Default arguments */ $defaultArgs = array('paged' => 1, 'meta_key' => '_thumbnail_id', 'post_type' => $this->_type, 'posts_per_page' => '-1'); $args = thb_array_asum($defaultArgs, $args); foreach (get_posts($args) as $item) { $thumb_id = get_post_thumbnail_id($item->ID); $this->_slides[] = array('post_id' => $item->ID, 'id' => $thumb_id, 'url' => thb_image_get_size($thumb_id, $this->_size), 'full' => thb_get_featured_image($item->ID, 'full'), 'thumb' => thb_get_featured_image($item->ID, $this->_thumbSize), 'caption' => '', 'type' => 'image', 'link' => false); } }
?> <?php $slide_data = array('type' => $slide['type']); if ($slide_data['type'] != 'image') { $slide_data['autoplay'] = $slide['autoplay']; } ?> <div class="slide" <?php thb_data_attributes($slide_data); ?> > <?php if ($slide['type'] == 'image') { ?> <img src="<?php echo thb_image_get_size($slide['id'], $image_size); ?> " alt=""> <?php } else { ?> <?php $attributes = thb_get_attributes(array('url' => $slide['url'], 'class' => 'thb_slideshow_video thb-noFit', 'autoplay' => $slide['autoplay'], 'loop' => $slide['loop'])); echo thb_do_shortcode('[thb_video ' . $attributes . ']'); ?> <?php } ?> <?php if ($slide['caption'] != '') {
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_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_image_get_sizes() { if (!empty($_POST)) { $height = $_POST['height']; $width = $_POST['width']; $src = $_POST['src']; echo thb_image_get_size($src, array($width, $height)); } die; }
<?php $preview = ''; if (!empty($field_value_id)) { $preview = thb_image_get_size($field_value_id, 'thumbnail'); $removeStyle = 'display: inline;'; } else { $preview = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=='; $removeStyle = 'display: none;'; } ?> <div class="thb-view-upload"> <input type="hidden" name="<?php echo $field_name_url; ?> " value="" class="thb-url"> <input type="hidden" name="<?php echo $field_name_id; ?> " value="<?php echo $field_value_id; ?> " class="thb-id"> <img src="<?php echo $preview; ?> " class="thb-preview image" alt=""> <?php