/** * Help information for the default image. * @return string * @since 2.6.0 */ protected function default_image() { $common = new Display_Featured_Image_Genesis_Common(); $large = $common->minimum_backstretch_width(); $help = '<p>' . __('You may set a large image to be used sitewide if a featured image is not available. This image will show on posts, pages, and archives.', 'display-featured-image-genesis') . '</p>'; $help .= '<p>' . sprintf(__('Supported file types are: jpg, jpeg, png, and gif. The image must be at least %1$s pixels wide.', 'display-featured-image-genesis'), absint($large + 1)) . '</p>'; $help .= '<p>' . __('If you choose "Always Use Default", your default image will be used site wide, no matter what content types/posts/etc. have featured images set.', 'display-featured-image-genesis') . '</p>'; return $help; }
/** * Decide whether or not to add the featured image to the feed or the feed excerpt * * @return filter the_excerpt_rss (if summaries) or the_content_feed (full text) * @since 1.5.0 */ public function maybe_do_feed() { $displaysetting = displayfeaturedimagegenesis_get_setting(); $feed_image = $displaysetting['feed_image']; // if the user isn't sending images to the feed, we're done if (!$feed_image || Display_Featured_Image_Genesis_Common::is_in_array('skipped_posttypes')) { return; } // if the feed is summary, filter the excerpt $which_filter = 'the_excerpt_rss'; $priority = 1000; $rss_option = get_option('rss_use_excerpt'); // if the feed is full text, filter the content if ('0' === $rss_option) { $which_filter = 'the_content_feed'; $priority = 15; } add_filter($which_filter, array($this, 'add_image_to_feed'), $priority); }
/** * function to check image_id value, convert from URL if necessary * @param string $image_id int or URL string * @return int image ID * * @since 2.3.0 */ function displayfeaturedimagegenesis_check_image_id($image_id = '') { $image_id = is_numeric($image_id) ? $image_id : Display_Featured_Image_Genesis_Common::get_image_id($image_id); return $image_id; }
/** * Custom validation function for the default image--ensure image is appropriately sized. * @param $new_value * * @return string * @since 2.6.0 */ public function send_image_to_validator($new_value) { $common = new Display_Featured_Image_Genesis_Common(); $size = $common->minimum_backstretch_width(); $new_value = $this->validate_image($new_value, $this->setting['default'], __('Default', 'display-featured-image-genesis'), $size); return $new_value; }
/** * Pass variables through to our js * @return backstretchVars variable array to send to js * * @since 2.3.0 */ public function localize_scripts() { // backstretch settings which can be filtered $backstretch_variables = apply_filters('display_featured_image_genesis_backstretch_variables', array('centeredX' => true, 'centeredY' => true, 'fade' => 750)); $image_id = Display_Featured_Image_Genesis_Common::set_image_id(); $large = wp_get_attachment_image_src($image_id, 'large'); $output = array('src' => esc_url($this->item->backstretch[0]), 'largesrc' => esc_url($large[0]), 'width' => $large[1], 'height' => (int) $this->displaysetting['less_header'], 'centeredX' => (bool) $backstretch_variables['centeredX'], 'centeredY' => (bool) $backstretch_variables['centeredY'], 'fade' => (int) $backstretch_variables['fade']); wp_localize_script('displayfeaturedimage-backstretch-set', 'BackStretchVars', $output); }
/** * Custom Post Type image uploader * * @return image * * @since 2.0.0 */ public function set_cpt_image($args) { $item = Display_Featured_Image_Genesis_Common::get_image_variables(); $post_type = $args['post_type']->name; if (empty($this->displaysetting['post_type'][$post_type])) { $this->displaysetting['post_type'][$post_type] = $id = ''; } $id = $this->displaysetting['post_type'][$post_type]; $name = 'displayfeaturedimagegenesis[post_type][' . esc_attr($post_type) . ']'; if ($id) { echo wp_kses_post($this->render_image_preview($id)); } $this->render_buttons($id, $name); if (empty($id)) { return; } $description = sprintf(__('View your <a href="%1$s" target="_blank">%2$s</a> archive.', 'display-featured-image-genesis'), esc_url(get_post_type_archive_link($post_type)), esc_attr($args['post_type']->label)); printf('<p class="description">%s</p>', wp_kses_post($description)); }
/** * filter to maybe move titles, or not * @var filter * @since 2.2.0 */ protected function move_title() { $keep_titles = $this->setting['keep_titles']; /** * Creates display_featured_image_genesis_do_not_move_titles filter to check * whether get_post_type array should not move titles to overlay the featured image. * @uses is_in_array() */ if ($keep_titles || Display_Featured_Image_Genesis_Common::is_in_array('do_not_move_titles') || $this->check_post_meta('_displayfeaturedimagegenesis_move')) { return false; } return true; }