本文整理汇总了PHP中get_intermediate_image_sizes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_intermediate_image_sizes函数的具体用法?PHP get_intermediate_image_sizes怎么用?PHP get_intermediate_image_sizes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_intermediate_image_sizes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_image_sizes
function get_image_sizes($size = '')
{
global $_wp_additional_image_sizes;
$sizes = array();
$get_intermediate_image_sizes = get_intermediate_image_sizes();
// Create the full array with sizes and crop info
foreach ($get_intermediate_image_sizes as $_size) {
if (in_array($_size, array('thumbnail', 'medium', 'large'))) {
$sizes[$_size]['width'] = get_option($_size . '_size_w');
$sizes[$_size]['height'] = get_option($_size . '_size_h');
$sizes[$_size]['crop'] = (bool) get_option($_size . '_crop');
} elseif (isset($_wp_additional_image_sizes[$_size])) {
$sizes[$_size] = array('width' => $_wp_additional_image_sizes[$_size]['width'], 'height' => $_wp_additional_image_sizes[$_size]['height'], 'crop' => $_wp_additional_image_sizes[$_size]['crop']);
}
}
// Get only 1 size if found
if ($size) {
if (isset($sizes[$size])) {
return $sizes[$size];
} else {
return false;
}
}
return $sizes;
}
开发者ID:shawfactor,项目名称:lh-ios-web-app,代码行数:25,代码来源:lh-ios-web-app.php
示例2: groundup_image_suffix
function groundup_image_suffix($image)
{
// Split the $image path into directory/extension/name
$info = pathinfo($image);
$dir = $info['dirname'] . '/';
$ext = '.' . $info['extension'];
$file_name = wp_basename($image, "{$ext}");
$image_name = substr($file_name, 0, strrpos($file_name, '-'));
// Get image information
$img = wp_get_image_editor($image);
// Get image size, width and height
$img_size = $img->get_size();
// Get new image suffix by comparing image sizes
$image_sizes = get_intermediate_image_sizes();
foreach ($image_sizes as $size) {
$rename = false;
$sizeInfo = get_image_size_data($size);
if ($img_size['width'] == $sizeInfo['width'] && $img_size['height'] <= $sizeInfo['height']) {
$rename = true;
} elseif ($img_size['height'] == $sizeInfo['height'] && $img_size['width'] <= $sizeInfo['width']) {
$rename = true;
}
if ($rename == true) {
// Rename image
$new_name = $dir . $image_name . '-' . $size . $ext;
// Rename the intermediate size
$rename_success = rename($image, $new_name);
if ($rename_success) {
return $new_name;
}
}
}
// do nothing if not renamed
return $image;
}
开发者ID:abacusadvertising,项目名称:groundup,代码行数:35,代码来源:admin.php
示例3: check_size_exist
function check_size_exist($size)
{
$registeredSized = get_intermediate_image_sizes();
if (!in_array($size, $registeredSized)) {
throw new Exception("This image size is not registered in wordpress");
}
}
开发者ID:slaven-ii,项目名称:pecina,代码行数:7,代码来源:images.php
示例4: get_html
public function get_html($media_id, $sizes = null, array $attrs = array(), $square = false, $def_wp_size = null, $use_fallback = false)
{
if (empty($def_wp_size)) {
$def_wp_size = $square ? 'thumbnail' : 'medium';
}
$img_src = wp_get_attachment_image_url($media_id, $def_wp_size);
if (empty($img_src)) {
$result = $use_fallback ? call_user_func_array(array($this, 'get_html_fallback'), func_get_args()) : false;
return $result;
}
$img_srcset = wp_get_attachment_image_srcset($media_id, $def_wp_size);
$img_data = array();
foreach (get_intermediate_image_sizes() as $size) {
$img_data[$size] = wp_get_attachment_image_src($media_id, $size);
}
$img_data = $this->filter_square($img_data, $square);
if (!empty($this->filter_srcset)) {
foreach ($this->filter_srcset as $filter) {
$img_srcset = call_user_func($filter, $img_data, $media_id, $size, $attrs, $square, $def_wp_size);
}
}
$attrs = array_merge(array('src' => $img_src, 'srcset' => $img_srcset, 'sizes' => $this->get_sizes($sizes)), $attrs);
if (empty($attrs['srcset'])) {
unset($attrs['srcset']);
unset($attrs['sizes']);
}
$result = \Cibulka::Base('HTML', 'img', $attrs, true);
return $result;
}
开发者ID:cibulka,项目名称:cibulka-wp-plugin-base,代码行数:29,代码来源:Image.php
示例5: pte_site_options_validate
function pte_site_options_validate($input)
{
//$sizes = pte_get_alternate_sizes(false);
if (!current_user_can('manage_options')) {
add_settings_error('pte_options_site', 'pte_options_error', __("Only users with the 'manage_options' capability may make changes to these settings.", PTE_DOMAIN));
return pte_get_site_options();
}
$sizes = get_intermediate_image_sizes();
$pte_hidden_sizes = array();
foreach ($sizes as $size) {
// Hidden
if (is_array($input['pte_hidden_sizes']) and in_array($size, $input['pte_hidden_sizes'])) {
$pte_hidden_sizes[] = $size;
}
}
$output = array('pte_hidden_sizes' => $pte_hidden_sizes);
// Check the JPEG Compression value
if ($input['pte_jpeg_compression'] != "") {
$tmp_jpeg_compression = (int) preg_replace("/[\\D]/", "", $input['pte_jpeg_compression']);
if (!is_int($tmp_jpeg_compression) || $tmp_jpeg_compression < 0 || $tmp_jpeg_compression > 100) {
add_settings_error('pte_options_site', 'pte_options_error', __("JPEG Compression needs to be set from 0 to 100.", PTE_DOMAIN) . $tmp_jpeg_compression . "/" . $input['pte_jpeg_compression']);
}
$output['pte_jpeg_compression'] = $tmp_jpeg_compression;
}
// Cache Buster
$output['cache_buster'] = isset($input['pte_cache_buster']);
return $output;
}
开发者ID:phupx,项目名称:genco,代码行数:28,代码来源:options.php
示例6: getImage
public function getImage($id)
{
$image_fields = array("ID" => "ID", "guid" => "file", "post_mime_type" => "mime_type");
$indexable_image_size = get_intermediate_image_sizes();
$uploadDir = wp_upload_dir();
$uploadBaseUrl = $uploadDir['baseurl'];
$image = new \stdClass();
$post = get_post($id);
foreach ($image_fields as $key => $value) {
$image->{$value} = $post->{$key};
}
$metas = get_post_meta($post->ID, '_wp_attachment_metadata', true);
$image->width = $metas["width"];
$image->height = $metas["height"];
$image->file = sprintf('%s/%s', $uploadBaseUrl, $metas["file"]);
$image->sizes = $metas["sizes"] ? $metas["sizes"] : array();
foreach ($image->sizes as $size => &$sizeAttrs) {
if (in_array($size, $indexable_image_size) == false) {
unset($image->sizes[$size]);
continue;
}
$baseFileUrl = str_replace(wp_basename($metas['file']), '', $metas['file']);
$sizeAttrs['file'] = sprintf('%s/%s%s', $uploadBaseUrl, $baseFileUrl, $sizeAttrs['file']);
}
return $image;
}
开发者ID:PoNote,项目名称:algoliasearch-wordpress,代码行数:26,代码来源:WordpressFetcher.php
示例7: ilab_get_image_sizes
function ilab_get_image_sizes($size = null)
{
global $_wp_additional_image_sizes;
$sizes = [];
$get_intermediate_image_sizes = get_intermediate_image_sizes();
// Create the full array with sizes and crop info
foreach ($get_intermediate_image_sizes as $_size) {
if (in_array($_size, ['thumbnail', 'medium', 'large'])) {
$sizes[$_size]['width'] = get_option($_size . '_size_w');
$sizes[$_size]['height'] = get_option($_size . '_size_h');
$sizes[$_size]['crop'] = (bool) get_option($_size . '_crop');
} else {
if (isset($_wp_additional_image_sizes[$_size])) {
$sizes[$_size] = ['width' => $_wp_additional_image_sizes[$_size]['width'], 'height' => $_wp_additional_image_sizes[$_size]['height'], 'crop' => $_wp_additional_image_sizes[$_size]['crop']];
}
}
}
if ($size != null) {
if (isset($sizes[$size])) {
return $sizes[$size];
}
return null;
}
return $sizes;
}
开发者ID:Air-Craft,项目名称:air-craft-www,代码行数:25,代码来源:ilab-media-tool-wordpress-helpers.php
示例8: simple_life_get_image_sizes_options
/**
* Returns image sizes options.
*
* @since 1.2
*
* @param bool $add_disable Add disable option or not.
* @param array $allowed Allowed array.
* @param bool $show_dimension Show or hide dimension.
*/
function simple_life_get_image_sizes_options($add_disable = true, $allowed = array(), $show_dimension = true)
{
global $_wp_additional_image_sizes;
$get_intermediate_image_sizes = get_intermediate_image_sizes();
$choices = array();
if (true === $add_disable) {
$choices['disable'] = esc_html__('No Image', 'simple-life');
}
$choices['thumbnail'] = esc_html__('Thumbnail', 'simple-life');
$choices['medium'] = esc_html__('Medium', 'simple-life');
$choices['large'] = esc_html__('Large', 'simple-life');
$choices['full'] = esc_html__('Full (original)', 'simple-life');
if (true === $show_dimension) {
foreach (array('thumbnail', 'medium', 'large') as $key => $_size) {
$choices[$_size] = $choices[$_size] . ' (' . get_option($_size . '_size_w') . 'x' . get_option($_size . '_size_h') . ')';
}
}
if (!empty($_wp_additional_image_sizes) && is_array($_wp_additional_image_sizes)) {
foreach ($_wp_additional_image_sizes as $key => $size) {
$choices[$key] = $key;
if (true === $show_dimension) {
$choices[$key] .= ' (' . $size['width'] . 'x' . $size['height'] . ')';
}
}
}
if (!empty($allowed)) {
foreach ($choices as $key => $value) {
if (!in_array($key, $allowed)) {
unset($choices[$key]);
}
}
}
return $choices;
}
开发者ID:ernilambar,项目名称:simple-life,代码行数:43,代码来源:helper.php
示例9: get_value
function get_value($id)
{
$paths = array();
$meta = get_post_meta($id, '_wp_attachment_metadata', true);
if (!isset($meta['sizes'])) {
return $this->get_empty_char();
}
// available sizes
if ($intersect = array_intersect(array_keys($meta['sizes']), get_intermediate_image_sizes())) {
$url = wp_get_attachment_url($id);
$filename = basename($url);
$paths[] = "<a title='{$filename}' href='{$url}'>" . __('full size', 'codepress-admin-columns') . "</a>";
foreach ($intersect as $size) {
$src = wp_get_attachment_image_src($id, $size);
if (!empty($src[0])) {
$filename = basename($src[0]);
$paths[] = "<a title='{$filename}' href='{$src[0]}' class='available'>{$size}</a>";
}
}
}
global $_wp_additional_image_sizes;
if (!empty($_wp_additional_image_sizes)) {
if (isset($_wp_additional_image_sizes['post-thumbnail'])) {
unset($_wp_additional_image_sizes['post-thumbnail']);
}
// image does not have these additional sizes rendered yet
if ($missing = array_diff(array_keys($_wp_additional_image_sizes), array_keys($meta['sizes']))) {
foreach ($missing as $size) {
$paths[] = "<span title='Missing size: Try regenerate thumbnails with the plugin: Force Regenerate Thumbnails' href='javascript:;' class='not-available'>{$size}</span>";
}
}
}
return "<div class='sizes'>" . implode('<span class="cpac-divider"></span>', $paths) . "</div>";
}
开发者ID:xeiter,项目名称:timeplannr,代码行数:34,代码来源:available-sizes.php
示例10: add_placeholder_sizes
/**
* Loop through registered image sizes and add placeholders
*
* @global array $_wp_additional_image_sizes
*/
function add_placeholder_sizes()
{
global $_wp_additional_image_sizes;
if (!isset($_wp_additional_image_sizes)) {
$_wp_additional_image_sizes = array();
}
$new_sizes = array();
foreach (get_intermediate_image_sizes() as $name) {
if (isset($_wp_additional_image_sizes[$name]['width'])) {
$width = absint($_wp_additional_image_sizes[$name]['width']);
} else {
$width = absint(get_option("{$name}_size_w"));
}
if (isset($_wp_additional_image_sizes[$name]['height'])) {
$height = absint($_wp_additional_image_sizes[$name]['height']);
} else {
$height = absint(get_option("{$name}_size_h"));
}
if (isset($_wp_additional_image_sizes[$name]['crop'])) {
$crop = $_wp_additional_image_sizes[$name]['crop'];
} else {
$crop = get_option("{$name}_crop");
}
$new_sizes[$name . '-ph'] = array('width' => $width, 'height' => $height, 'crop' => $crop);
}
$_wp_additional_image_sizes = array_merge($_wp_additional_image_sizes, $new_sizes);
}
开发者ID:10up,项目名称:swiftstream,代码行数:32,代码来源:pixelate.php
示例11: get_attachment_image_html
/**
* @param array $settings [ image => [ id => '', url => '' ], image_size => '', hover_animation => '' ]
*
* @return string
*/
public static function get_attachment_image_html($settings)
{
$id = $settings['image']['id'];
$url = $settings['image']['url'];
// Old version of image settings
if (!isset($settings['image_size'])) {
$settings['image_size'] = '';
}
$size = $settings['image_size'];
$image_class = !empty($settings['hover_animation']) ? 'elementor-animation-' . $settings['hover_animation'] : '';
$html = '';
// If is the new version - with image size
$image_sizes = get_intermediate_image_sizes();
$image_sizes[] = 'full';
if (!empty($id) && in_array($size, $image_sizes)) {
$image_class .= " attachment-{$size} size-{$size}";
$html .= wp_get_attachment_image($id, $size, false, ['class' => trim($image_class)]);
} else {
$image_src = Group_Control_Image_Size::get_attachment_image_src($id, 'image', $settings);
if (!$image_src) {
$image_src = $url;
}
$image_class_html = !empty($image_class) ? ' class="' . $image_class . '"' : '';
$html .= sprintf('<img src="%s" title="%s" alt="%s"%s />', esc_attr($image_src), Control_Media::get_image_title($settings['image']), Control_Media::get_image_alt($settings['image']), $image_class_html);
}
return $html;
}
开发者ID:pojome,项目名称:elementor,代码行数:32,代码来源:image-size.php
示例12: sri_get_image_sizes
function sri_get_image_sizes($prefix = 'src-')
{
global $_wp_additional_image_sizes;
$other_sizes = array();
foreach (get_intermediate_image_sizes() as $s) {
if (isset($_wp_additional_image_sizes[$s]['width'])) {
// For theme-added sizes
$width = intval($_wp_additional_image_sizes[$s]['width']);
} else {
// For default sizes set in options
$width = get_option("{$s}_size_w");
}
// Set height
if (isset($_wp_additional_image_sizes[$s]['height'])) {
// For theme-added sizes
$height = intval($_wp_additional_image_sizes[$s]['height']);
} else {
// For default sizes set in options
$height = get_option("{$s}_size_h");
}
$other_sizes[] = array($prefix . $s, $width, $height);
}
$other_sizes[] = array($prefix . "full", 'max', 'max');
return $other_sizes;
}
开发者ID:AgnaldoJaws,项目名称:belavista-wp,代码行数:25,代码来源:functions.plugin.php
示例13: hoot_get_image_size_links
/**
* Returns a set of image attachment links based on size.
*
* @since 1.0.0
* @access public
* @return string
*/
function hoot_get_image_size_links()
{
/* If not viewing an image attachment page, return. */
if (!wp_attachment_is_image(get_the_ID())) {
return;
}
/* Set up an empty array for the links. */
$links = array();
/* Get the intermediate image sizes and add the full size to the array. */
$sizes = get_intermediate_image_sizes();
$sizes[] = 'full';
/* Loop through each of the image sizes. */
foreach ($sizes as $size) {
/* Get the image source, width, height, and whether it's intermediate. */
$image = wp_get_attachment_image_src(get_the_ID(), $size);
/* Add the link to the array if there's an image and if $is_intermediate (4th array value) is true or full size. */
if (!empty($image) && (true === $image[3] || 'full' == $size)) {
/* Translators: Media dimensions - 1 is width and 2 is height. */
$label = sprintf(__('%1$s × %2$s', 'chromatic'), number_format_i18n(absint($image[1])), number_format_i18n(absint($image[2])));
$links[] = sprintf('<a class="image-size-link">%s</a>', $label);
}
}
/* Join the links in a string and return. */
return join(' <span class="sep">/</span> ', $links);
}
开发者ID:acafourek,项目名称:maidstone,代码行数:32,代码来源:template-media.php
示例14: kt_get_image_sizes
/**
* Get image sizes
*
* @return array
*/
function kt_get_image_sizes($full = true, $custom = false)
{
global $_wp_additional_image_sizes;
$get_intermediate_image_sizes = get_intermediate_image_sizes();
$sizes = array();
// Create the full array with sizes and crop info
foreach ($get_intermediate_image_sizes as $_size) {
if (in_array($_size, array('thumbnail', 'medium', 'large'))) {
$sizes[$_size]['width'] = get_option($_size . '_size_w');
$sizes[$_size]['height'] = get_option($_size . '_size_h');
$sizes[$_size]['crop'] = (bool) get_option($_size . '_crop');
} elseif (isset($_wp_additional_image_sizes[$_size])) {
$sizes[$_size] = array('width' => $_wp_additional_image_sizes[$_size]['width'], 'height' => $_wp_additional_image_sizes[$_size]['height'], 'crop' => $_wp_additional_image_sizes[$_size]['crop']);
}
$option_text = array();
$option_text[] = ucfirst(str_replace('_', ' ', $_size));
if (isset($sizes[$_size])) {
$option_text[] = '(' . $sizes[$_size]['width'] . ' x ' . $sizes[$_size]['height'] . ')';
if ($sizes[$_size]['crop']) {
$option_text[] = esc_html__('Crop', 'adroit');
}
$sizes[$_size] = implode(' - ', $option_text);
}
}
if ($full) {
$sizes['full'] = esc_html__('Full', 'adroit');
}
if ($custom) {
$sizes['custom'] = esc_html__('Custom size', 'adroit');
}
return $sizes;
}
开发者ID:websideas,项目名称:Mondova,代码行数:37,代码来源:helpers.php
示例15: gdlr_get_video_size
function gdlr_get_video_size($size)
{
global $_wp_additional_image_sizes, $theme_option, $gdlr_crop_video;
// get video ratio
if (!empty($theme_option['video-ratio']) && preg_match('#^(\\d+)[\\/:](\\d+)$#', $theme_option['video-ratio'], $number)) {
$ratio = $number[1] / $number[2];
} else {
$ratio = 16 / 9;
}
// get video size
$video_size = array('width' => 620, 'height' => 9999);
if (!empty($size) && is_numeric($size)) {
$video_size['width'] = intval($size);
} else {
if (!empty($size) && !empty($_wp_additional_image_sizes[$size])) {
$video_size = $_wp_additional_image_sizes[$size];
} else {
if (!empty($size) && in_array($size, get_intermediate_image_sizes())) {
$video_size = array('width' => get_option($size . '_size_w'), 'height' => get_option($size . '_size_h'));
}
}
}
// refine video size
if ($gdlr_crop_video || $video_size['height'] == 9999) {
return array('width' => $video_size['width'], 'height' => intval($video_size['width'] / $ratio));
} else {
if ($video_size['width'] == 9999) {
return array('width' => intval($video_size['height'] * $ratio), 'height' => $video_size['height']);
}
}
return $video_size;
}
开发者ID:hoa32811,项目名称:wp_thanhtrung_hotel,代码行数:32,代码来源:functions-size.php
示例16: __construct
/**
* Init
*/
public function __construct()
{
/** Ajax pagination for property_overview */
add_action("wp_ajax_wpp_property_overview_pagination", array($this, "ajax_handler"));
add_action("wp_ajax_nopriv_wpp_property_overview_pagination", array($this, "ajax_handler"));
$custom_attributes = ud_get_wp_property('property_stats', array());
$image_sizes = array('' => __('No Image', ud_get_wp_property('domain')));
foreach (get_intermediate_image_sizes() as $name) {
$sizes = \WPP_F::image_sizes($name);
if (!$sizes) {
continue;
}
$image_sizes[$name] = $name . ' (' . $sizes['width'] . 'x' . $sizes['height'] . 'px)';
}
$sort_by = array('post_date' => sprintf(__('Post Date (%s)', ud_get_wp_property('domain')), 'post_date'), 'post_modified' => sprintf(__('Modified Date (%s)', ud_get_wp_property('domain')), 'post_modified'), 'random' => sprintf(__('Random (%s)', ud_get_wp_property('domain')), 'random'), 'menu_order' => sprintf(__('Menu Order (%s)', ud_get_wp_property('domain')), 'menu_order'));
$sortable_atts = ud_get_wp_property('sortable_attributes', array());
if (!empty($sortable_atts) && is_array($sortable_atts)) {
foreach ($sortable_atts as $attr) {
if (array_key_exists($attr, $custom_attributes)) {
$sort_by[$attr] = $custom_attributes[$attr] . ' (' . $attr . ')';
}
}
}
$options = array('id' => 'property_overview', 'params' => array('property_id' => array('name' => __('Property ID', ud_get_wp_property()->domain), 'description' => __('If not empty, result will show particular property, which ID is set.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => ''), 'post_parent' => array('name' => sprintf(__('Parent %s', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('If not empty, result will show children of particular property, which ID is set. You can use dynamic attributes instead of ID such as %1$s or %2$s.<br/>%1$s - to list all the listings that are a child of the current %3$s.<br/>%2$s - to list all listings that are children of the same parent (i.e. siblings) of the current %3$s', ud_get_wp_property('domain')), '<b>post_id</b>', '<b>post_parent</b>', \WPP_F::property_label()), 'type' => 'text', 'default' => ''), 'property_type' => array('name' => sprintf(__('%s Type', ud_get_wp_property('domain')), \WPP_F::property_label()), 'description' => sprintf(__('The list of %s types to be included. If no type checked, all available %s will be shown.', ud_get_wp_property('domain')), \WPP_F::property_label(), \WPP_F::property_label('plural')), 'type' => 'multi_checkbox', 'options' => ud_get_wp_property('property_types')), 'featured' => array('name' => sprintf(__('Show only Featured %s', ud_get_wp_property('domain')), \WPP_F::property_label('plural')), 'type' => 'checkbox'), 'custom_query' => array('name' => __('Custom Query by Attributes Values', ud_get_wp_property()->domain), 'description' => sprintf(__('Setup your custom query by providing values for specific attributes. Empty values will be ignored. Example:<br/>- to list only %1$s which have minimum 2 and maximum 4 bedrooms, you should set <b>2-4</b> value for your Bedrooms attribute.<br/>- to list only %1$s which have 1 or 3 bathrooms, you should set <b>1,3</b> value for your Batrooms attribute.', ud_get_wp_property('domain')), \WPP_F::property_label()), 'type' => 'custom_attributes', 'options' => $custom_attributes), 'show_children' => array('name' => __('Show Children', ud_get_wp_property()->domain), 'description' => sprintf(__('Switches children %s displaying.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'true'), 'child_properties_title' => array('name' => sprintf(__('Child %s Title', ud_get_wp_property()->domain), \WPP_F::property_label('plural')), 'description' => sprintf(__('Title for Child %s section.', ud_get_wp_property()->domain), \WPP_F::property_label('plural')), 'type' => 'text', 'default' => __('Floor plans at location:', ud_get_wp_property()->domain)), 'fancybox_preview' => array('name' => __('Fancybox Preview', ud_get_wp_property()->domain), 'description' => __('Use fancybox preview.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'true'), 'bottom_pagination_flag' => array('name' => __('Bottom Pagination', ud_get_wp_property()->domain), 'description' => __('Show Bottom Pagination.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'thumbnail_size' => array('name' => __('Thumbnail Size', ud_get_wp_property()->domain), 'description' => __('Show image with specific image size', ud_get_wp_property()->domain), 'type' => 'select', 'options' => $image_sizes, 'default' => 'thumbnail'), 'sort_by_text' => array('name' => __('Sort By Text', ud_get_wp_property()->domain), 'description' => __('Renames "Sort By:" text.', ud_get_wp_property()->domain), 'type' => 'text', 'default' => __('Sort By', ud_get_wp_property()->domain)), 'sort_by' => array('name' => __('Sort By', ud_get_wp_property()->domain), 'description' => sprintf(__('Sets sorting by sortable attribute or %s.', ud_get_wp_property()->domain), 'post_date, menu_order, random'), 'type' => 'select', 'options' => $sort_by, 'default' => 'post_date'), 'sort_order' => array('name' => __('Sort Order', ud_get_wp_property()->domain), 'description' => __('Sort Order', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('DESC' => 'DESC', 'ASC' => 'ASC'), 'default' => 'DESC'), 'template' => array('name' => __('Template', ud_get_wp_property()->domain), 'description' => sprintf(__('Sets layout using PHP template name. Your custom template should be stored in your theme\'s root directory. Example:<br/>if your custom template is called %s, the value of template must be %s.', ud_get_wp_property('domain')), '<b>property-overview-grid.php</b>', '<b>grid</b>'), 'type' => 'text'), 'sorter_type' => array('name' => __('Sorter Type', ud_get_wp_property()->domain), 'description' => __('Sorter Type', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('none' => __('None', ud_get_wp_property()->domain), 'buttons' => __('Buttons', ud_get_wp_property()->domain), 'dropdown' => __('Dropdown', ud_get_wp_property()->domain)), 'default' => 'buttons'), 'sorter' => array('name' => __('Sorter', ud_get_wp_property()->domain), 'description' => __('Show Sort UI', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('On', ud_get_wp_property()->domain), 'off' => __('Off', ud_get_wp_property()->domain)), 'default' => 'on'), 'pagination' => array('name' => __('Pagination', ud_get_wp_property()->domain), 'description' => __('Show Pagination', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('on' => __('On', ud_get_wp_property()->domain), 'off' => __('Off', ud_get_wp_property()->domain)), 'default' => 'on'), 'pagination_type' => array('name' => __('Pagination Type', ud_get_wp_property()->domain), 'description' => __('Determine pagination UI', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('slider' => __('slider', ud_get_wp_property()->domain), 'numeric' => __('numeric', ud_get_wp_property()->domain)), 'default' => ud_get_wp_property('configuration.property_overview.pagination_type') ? ud_get_wp_property('configuration.property_overview.pagination_type') : 'slider'), 'per_page' => array('name' => __('Per Page', ud_get_wp_property()->domain), 'description' => sprintf(__('%s quantity per page.', ud_get_wp_property()->domain), \WPP_F::property_label()), 'type' => 'number', 'default' => 10), 'starting_row' => array('name' => __('Starting Row', ud_get_wp_property()->domain), 'description' => __('Sets starting row.', ud_get_wp_property()->domain), 'type' => 'number', 'default' => 0), 'detail_button' => array('name' => __('Detail Button', ud_get_wp_property()->domain), 'description' => __('Name of Detail Button. Button will not be shown if the value is empty.', ud_get_wp_property()->domain), 'type' => 'text'), 'hide_count' => array('name' => __('Hide Count', ud_get_wp_property()->domain), 'description' => __('Hide the "10 found." text.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'in_new_window' => array('name' => __('In new window?', ud_get_wp_property()->domain), 'description' => __('Open links in new window.', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false'), 'strict_search' => array('name' => __('Strict Search', ud_get_wp_property()->domain), 'description' => __('Provides strict search', ud_get_wp_property()->domain), 'type' => 'select', 'options' => array('true' => __('Yes', ud_get_wp_property()->domain), 'false' => __('No', ud_get_wp_property()->domain)), 'default' => 'false')), 'description' => sprintf(__('Renders %s Attributes', ud_get_wp_property()->domain), \WPP_F::property_label()), 'group' => 'WP-Property');
parent::__construct($options);
}
开发者ID:ksan5835,项目名称:rankproperties,代码行数:29,代码来源:property-overview.php
示例17: get_image_sizes
/**
* Get size information for all currently-registered image sizes.
*
* @global $_wp_additional_image_sizes
* @uses get_intermediate_image_sizes()
* @return array $sizes Data for all currently-registered image sizes.
*/
function get_image_sizes()
{
global $_wp_additional_image_sizes;
$sizes = array();
$output = '';
foreach (get_intermediate_image_sizes() as $_size) {
if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
$sizes[$_size]['width'] = get_option("{$_size}_size_w");
$sizes[$_size]['height'] = get_option("{$_size}_size_h");
$sizes[$_size]['crop'] = (bool) get_option("{$_size}_crop");
} elseif (isset($_wp_additional_image_sizes[$_size])) {
$sizes[$_size] = array('width' => $_wp_additional_image_sizes[$_size]['width'], 'height' => $_wp_additional_image_sizes[$_size]['height'], 'crop' => $_wp_additional_image_sizes[$_size]['crop']);
}
}
foreach ($sizes as $image_size => $image_size_data) {
$crop = '';
if (is_array($image_size_data['crop'])) {
$crop = 'true ' . $image_size_data['crop'][0] . '-' . $image_size_data['crop'][0];
} else {
$crop = $image_size_data['crop'] ? 'true auto' : 'false';
}
$output .= '<tr><td>' . $image_size . '</td><td> ' . $image_size_data['width'] . 'x' . $image_size_data['height'] . '</td><td>Croop: ' . $crop . '</td></tr> ';
}
return '<table>' . $output . '</table>';
}
开发者ID:Zsolt-R,项目名称:wps-prime,代码行数:32,代码来源:system-status-settings.php
示例18: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
extract($args);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
global $post;
//Returns Array of Term Names for "collection"
$terms = wp_get_post_terms($post->ID, 'collection', array("fields" => "slugs"));
if (!empty($terms)) {
$args = array('tax_query' => array(array('taxonomy' => 'collection', 'field' => 'slug', 'terms' => $terms)), 'posts_per_page' => '6', 'orderby' => 'rand');
} else {
$args = array('post_type' => 'sell_media_item', 'field' => 'slug', 'orderby' => 'rand', 'posts_per_page' => '6');
}
?>
<div class="sell-media-similar-widget sell-media">
<?php
// Get available image sizes
$image_sizes = get_intermediate_image_sizes();
?>
<?php
$type_posts = new WP_Query($args);
?>
<?php
while ($type_posts->have_posts()) {
$type_posts->the_post();
global $post;
?>
<div class="sell-media-widget-item-warp sell-media-grid">
<div class="sell-media-widget-thumb-wrap">
<a href="<?php
echo get_permalink();
?>
">
<?php
sell_media_item_icon($post->ID, apply_filters('sell_media_thumbnail', 'thumbnail'));
?>
</a>
</div>
</div> <!-- .sell-media-widget-item-warp -->
<?php
}
wp_reset_postdata();
?>
</div><!-- .sell-media-recent -->
<?php
echo $after_widget;
}
开发者ID:aceherbert,项目名称:Sell-Media,代码行数:59,代码来源:sell-media-similar.php
示例19: slupy_shortcode_options_for_ts
function slupy_shortcode_options_for_ts($args)
{
foreach (get_intermediate_image_sizes() as $key => $image_size) {
$all_image_size[] = array('label' => $image_size, 'value' => $image_size);
}
$slupy_settings = array(array('title' => __('Portfolio', TS_PTD), 'id' => 'slupy_portfolio', 'shortcode' => '[slupy_portfolio{attr}]', 'options' => array(array('title' => __('Thumbnail Model', TS_PTD), 'name' => 'model', 'id' => '', 'dependid' => 'portfolio_model', 'class' => '', 'choices' => array(array('label' => __('Model 1', TS_PTD), 'value' => '1'), array('label' => __('Model 2', TS_PTD), 'value' => '2'), array('label' => __('Model 3', TS_PTD), 'value' => '3')), 'value' => '', 'type' => 'select'), array('title' => __('List Type', TS_PTD), 'name' => 'masonry', 'id' => '', 'dependid' => 'portfolio_masonry', 'depends' => 'portfolio_model:1|2', 'class' => 'big_switch', 'value' => 'on', 'text' => __('MASONRY', TS_PTD) . ':' . __('GRID', TS_PTD), 'type' => 'switch'), array('title' => __('Fit Grid Height?', TS_PTD), 'name' => 'fit_grid', 'id' => '', 'depends' => 'portfolio_model:1|2 + portfolio_masonry:off', 'class' => '', 'value' => 'on', 'text' => __('ON', TS_PTD) . ':' . __('OFF', TS_PTD), 'type' => 'switch'), array('title' => __('Loop Items Padding?', TS_PTD), 'name' => 'padding', 'id' => '', 'depends' => 'portfolio_model:1|2', 'class' => '', 'value' => 'on', 'text' => __('ON', TS_PTD) . ':' . __('OFF', TS_PTD), 'type' => 'switch'), array('title' => __('Filterable', TS_PTD), 'name' => 'filterable', 'id' => '', 'class' => '', 'value' => 'on', 'text' => __('ON', TS_PTD) . ':' . __('OFF', TS_PTD), 'type' => 'switch'), array('title' => __('Portfolio Max Columns', TS_PTD), 'name' => 'max_columns', 'id' => '', 'class' => '', 'choices' => array(array('label' => '2', 'value' => '2'), array('label' => '3', 'value' => '3'), array('label' => '4', 'value' => '4'), array('label' => '5', 'value' => '5')), 'value' => '3', 'type' => 'select'), array('title' => __('Pagination Style', TS_PTD), 'name' => 'pagination', 'id' => '', 'class' => '', 'choices' => array(array('label' => __('Load More', TS_PTD), 'value' => 'loadmore'), array('label' => __('Older & Newer Button', TS_PTD), 'value' => 'oldernewer'), array('label' => __('Page Numbers', TS_PTD), 'value' => 'pagenumbers')), 'value' => '', 'type' => 'select'), array('title' => __('Portfolio Per Page', TS_PTD), 'name' => 'posts_per_page', 'id' => '', 'class' => '', 'value' => '10', 'min_max_step' => '2,30,1', 'type' => 'numeric-slider'), array('title' => __('Image Size', TS_PTD), 'name' => 'image_size', 'id' => '', 'class' => '', 'choices' => $all_image_size, 'value' => '', 'type' => 'select'))), array('title' => __('Latest Projects', TS_PTD), 'id' => 'slupy_cportfolio', 'shortcode' => '[slupy_cportfolio{attr}]', 'options' => array(array('title' => __('Thumbnail Model', TS_PTD), 'name' => 'model', 'id' => '', 'class' => '', 'choices' => array(array('label' => __('Model 1', TS_PTD), 'value' => '1'), array('label' => __('Model 2', TS_PTD), 'value' => '2')), 'value' => '', 'type' => 'select'), array('title' => __('Limit', TS_PTD), 'name' => 'limit', 'id' => '', 'class' => '', 'value' => '8', 'min_max_step' => '4,12,1', 'type' => 'numeric-slider'), array('title' => __('Image Size', TS_PTD), 'name' => 'image_size', 'id' => '', 'class' => '', 'choices' => $all_image_size, 'value' => '', 'type' => 'select'), array('title' => __('Auto Play', TS_PTD), 'name' => 'autoplay', 'id' => '', 'class' => '', 'value' => 'on', 'text' => __('ON', TS_PTD) . ':' . __('OFF', TS_PTD), 'type' => 'switch'), array('title' => __('Stop on Hover', TS_PTD), 'name' => 'stop_hover', 'id' => '', 'class' => '', 'value' => 'on', 'text' => __('ON', TS_PTD) . ':' . __('OFF', TS_PTD), 'type' => 'switch'), array('title' => __('Pagination', TS_PTD), 'name' => 'pagination', 'id' => '', 'class' => '', 'val
|
请发表评论