function content($block) { //Use header image if there is one if ($header_image_src = parent::get_setting($block, 'header-image')) { do_action('headway_before_header_link'); if (parent::get_setting($block, 'resize-header-image', true)) { $block_width = HeadwayBlocksData::get_block_width($block); $block_height = HeadwayBlocksData::get_block_height($block); $header_image_url = headway_resize_image($header_image_src, $block_width, $block_height); } else { $header_image_url = $header_image_src; } echo '<a href="' . home_url() . '" class="banner-image"><img src="' . $header_image_url . '" alt="' . get_bloginfo('name') . '" /></a>'; do_action('headway_after_header_link'); //No image present } else { do_action('headway_before_header_link'); echo '<span class="banner"><a href="' . home_url() . '">' . get_bloginfo('name') . '</a></span>'; do_action('headway_after_header_link'); if (!parent::get_setting($block, 'hide-tagline', false)) { if ((is_front_page() || is_home()) && get_option('show_on_front') != 'page') { echo '<h1 class="tagline">' . get_bloginfo('description') . '</h1>' . "\n"; } else { echo '<span class="tagline">' . get_bloginfo('description') . '</span>' . "\n"; } do_action('headway_after_tagline'); } } }
function content($block) { $images = parent::get_setting($block, 'images', array()); $block_width = HeadwayBlocksData::get_block_width($block); $block_height = HeadwayBlocksData::get_block_height($block); $has_images = false; foreach ($images as $image) { if ($image['image']) { $has_images = true; break; } } if (!$has_images) { echo '<div class="alert alert-yellow"><p>There are no images to display.</p></div>'; return; } $no_slide_class = count($images) === 1 ? ' flexslider-no-slide' : ''; echo '<div class="flexslider' . $no_slide_class . '">'; /* Put in viewport div for sliders that only have 1 image and don't slide */ if (count($images) === 1) { echo '<div class="flex-viewport">'; } echo '<ul class="slides">'; foreach ($images as $image) { if (!$image['image']) { continue; } $output = array('image' => array('src' => parent::get_setting($block, 'crop-resize-images', true) ? headway_resize_image($image['image'], $block_width, $block_height) : $image['image'], 'alt' => headway_fix_data_type(headway_get('image-alt', $image)), 'title' => headway_fix_data_type(headway_get('image-title', $image)), 'caption' => headway_fix_data_type(headway_get('image-description', $image))), 'hyperlink' => array('href' => headway_fix_data_type(headway_get('image-hyperlink', $image)), 'target' => headway_fix_data_type(headway_get('image-open-link-in-new-window', $image, false)) ? ' target="_blank"' : null)); echo '<li>'; /* Open hyperlink if user added one for image */ if ($output['hyperlink']['href']) { echo '<a href="' . $output['hyperlink']['href'] . '"' . $output['hyperlink']['target'] . '>'; } /* Don't forget to display the ACTUAL IMAGE */ echo '<img src="' . $output['image']['src'] . '" alt="' . $output['image']['alt'] . '" title="' . $output['image']['title'] . '" />'; /* Closing tag for hyperlink */ if ($output['hyperlink']['href']) { echo '</a>'; } /* Caption */ if (!empty($output['image']['caption'])) { echo '<p class="flex-caption">' . $output['image']['caption'] . '</p>'; } echo '</li>'; } echo '</ul>'; /* Put in viewport div for sliders that only have 1 image and don't slide */ if (count($images) === 1) { echo '</div><!-- .flex-viewport -->'; } echo '</div><!-- .flexslider -->'; }
function display_thumbnail($post, $area = 'above-title') { if (!has_post_thumbnail() || !$this->get_setting('show-post-thumbnails', true) || !apply_filters('headway_featured_image_src', wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'))) { return; } $entry_thumbnail_position = $this->get_setting('use-entry-thumbnail-position', true) ? HeadwayLayoutOption::get($post->ID, 'position', 'post-thumbnail') : false; $position = $entry_thumbnail_position ? $entry_thumbnail_position : $this->get_setting('post-thumbnail-position', 'left'); if ($area == 'above-content' && $position != 'above-content' || $area == 'above-title' && $position == 'above-content') { return; } /* Get the size for cropping */ if ($position == 'left' || $position == 'right') { $thumbnail_width = $this->get_setting('post-thumbnail-size', 125); $thumbnail_height = $thumbnail_width; } else { $thumbnail_width = HeadwayBlocksData::get_block_width($this->block); $thumbnail_height = $thumbnail_width * ($this->get_setting('post-thumbnail-height-ratio', 35) * 0.01); } /* Get the image URL */ if ($this->get_setting('crop-post-thumbnails', true)) { $thumbnail = apply_filters('headway_featured_image_src', wp_get_attachment_image_src(get_post_thumbnail_id(), 'full')); $thumbnail_url = apply_filters('headway_featured_image_url', headway_resize_image($thumbnail[0], $thumbnail_width, $thumbnail_height)); } else { $thumbnail = apply_filters('headway_featured_image_src', wp_get_attachment_image_src(get_post_thumbnail_id(), array($thumbnail_width, $thumbnail_height))); $thumbnail_url = apply_filters('headway_featured_image_url', $thumbnail[0]); $thumbnail_width = $thumbnail[1]; $thumbnail_height = $thumbnail[2]; } echo ' <a href="' . get_permalink() . '" class="post-thumbnail post-thumbnail-' . $position . '"> <img src="' . esc_url($thumbnail_url) . '" alt="' . get_the_title() . '" width="' . $thumbnail_width . '" height="' . $thumbnail_height . '" /> </a> '; }