function ci_theme_enqueue_header_css() { $css = ''; $slides_count = 0; if (is_page_template('template-frontpage.php')) { $slides = ci_theme_get_slides(false, false, true); $slides_count = $slides->post_count; } if (is_page_template('template-frontpage.php') && $slides_count > 0) { $css = '#header { background: none; border: none; }'; } else { $img_url = ci_setting('default_header_bg'); $img_id = ci_setting('default_header_bg_hidden'); if (!empty($img_url) and !empty($img_id)) { $img_url = ci_get_image_src($img_id, 'ci_page_header'); } if (!empty($img_url)) { $css = '#header { background-image: url("' . esc_url($img_url) . '"); }'; } } wp_add_inline_style('ci-color-scheme', $css); }
?> "> <?php global $post; ?> <a class="zoom" data-rel="prettyPhoto[gal]" href="<?php echo ci_get_image_src($post->ID, 'large'); ?> "> <figure class="item-thumb"> <?php $attachment = wp_prepare_attachment_for_js($post->ID); ?> <img src="<?php echo ci_get_image_src($post->ID, $thumb_size); ?> " alt="<?php echo esc_attr($attachment['alt']); ?> "> </figure> </a> <?php if ($caption) { ?> <div class="item-info"> <p class="item-byline"><?php the_excerpt(); ?> </p>
/** * Returns just the URL of the featured image. * * @param string $size The size of the image to return. * @param int|bool $post_id The post's ID of which to get the featured image. Default to false, to get the current post ID if in the loop. * @return bool|string False on failure, image URL on success. */ function ci_get_featured_image_src($size, $post_id = false) { if ($post_id === false) { global $post; $post_id = $post->ID; } if (has_post_thumbnail($post_id)) { return ci_get_image_src(get_post_thumbnail_id($post_id), $size); } return false; }
/** * Reads $csv for a comma separated list of image attachment IDs. Returns a php array of image URLs and IDs, or false. * * @param string $csv A comma separated list of image attachment IDs. * @return array|bool */ function ci_featgal_get_images($csv = false) { $ids = explode(',', $csv); $ids = array_filter($ids); if (count($ids) > 0) { $ids = array_map('intval', $ids); $ids = array_map('abs', $ids); $urls = array(); $image_sizes = ci_get_image_sizes(); foreach ($ids as $id) { $thumb_file = ci_get_image_src($id, 'ci_featgal_small_thumb'); $file = parse_url($thumb_file); $file = pathinfo($file['path']); $file = basename($file['basename'], '.' . $file['extension']); $size = $image_sizes['ci_featgal_small_thumb']['width'] . 'x' . $image_sizes['ci_featgal_small_thumb']['height']; if (substr_right($file, strlen($size)) == $size) { $file = $thumb_file; } else { $file = ci_get_image_src($id, 'thumbnail'); } $data = array('id' => $id, 'url' => $file); $urls[] = $data; } return $urls; } else { return false; } }
$thumbs->the_post(); ?> <li data-pile="<?php echo $gallery_title; ?> "> <a class="zoom" data-rel="prettyPhoto[<?php echo $gallery_id; ?> ]" href="<?php echo ci_get_image_src($post->ID, 'large'); ?> "> <figure class="item-thumb"> <img src="<?php echo ci_get_image_src($post->ID, 'ci_thumb_sm'); ?> " alt=""> </figure> <?php if ($caption) { ?> <div class="item-info"> <p class="item-byline"><?php the_excerpt(); ?> </p> </div> <?php } ?>