siv1987, огромное спасибо за ответ!
Но что-то у меня не получается... :)
Делаю так:
Ничего не возвращает... Что я делаю не так?
Вопрос: зачем?
Хотите понизить читаемость для кого-то? Это глупо, ибо есть куча инструментов в нете, которые сделают ваш код полностью читаемым -- с табуляциями, показывающими структуру.
Только самому написать несложный JS код (используя тот же JQuery).
В самом JQueryUI Slider этого не предусмотрено.
Если поправить _src файл JS, то ничего не изменится, так как минифицированная версия скрипта грузится. ;)
Там же, в тикете, пишут о двух других решениях проблемы с уже установленным обновлением ВП 3.7:
1. Вроде как, использование Tiny MCE Advanced убирает этот глюк. (щас проверю -- отпишусь).
-- UPDATE: проверено -- лично у меня проблему не решило.
2. Можно скачать отсюда уже исправленный и подготовленный (минификация, сжатие) файл JS и заменить у себя (в wp-includes\js\tinymce): http://core.svn.wordpress.org/branches/3.7/wp-includes/js/tinymce/wp-tinymce.js.gz
-- UPDATE: проверено -- работает.
Что-то я не нашёл, где в админке контролируются параметры автоматических апдейтов. Или только хардкодить переменные?
exarh, можно самому написать, не? Не плагин, а скриптик, который бы выудил из базы все *.jpg( + *.png + .etc), а затем удалить все файлы, которые не нашлись в БД.
И в каком состоянии надо быть для этого?
Аудио- и видео-шорткоды (не от слова "шорты", а от слова "short"🤪 ) теперь легко кастомайзить (добавили фильтры для них):
Всё в том же media.php находится.
function wp_audio_shortcode( $attr, $content = '' ) { $post_id = get_post() ? get_the_ID() : 0; static $instances = 0; $instances++; /** * Override the default audio shortcode. * * @since 3.7.0 * * @param null Empty variable to be replaced with shortcode markup. * @param array $attr Attributes of the shortcode. * @param string $content Shortcode content. * @param int $instances Unique numeric ID of this audio shortcode instance. */ $html = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instances ); if ( '' !== $html ) return $html; $audio = null; $default_types = wp_get_audio_extensions(); $defaults_atts = array( 'src' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'none' ); foreach ( $default_types as $type ) $defaults_atts[$type] = ''; $atts = shortcode_atts( $defaults_atts, $attr, 'audio' ); extract( $atts ); $primary = false; if ( ! empty( $src ) ) { $type = wp_check_filetype( $src, wp_get_mime_types() ); if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) return sprintf( '<a class="wp-embedded-audio" href="%s">%s</a>', esc_url( $src ), esc_html( $src ) ); $primary = true; array_unshift( $default_types, 'src' ); } else { foreach ( $default_types as $ext ) { if ( ! empty( $$ext ) ) { $type = wp_check_filetype( $$ext, wp_get_mime_types() ); if ( strtolower( $type['ext'] ) === $ext ) $primary = true; } } } if ( ! $primary ) { $audios = get_attached_media( 'audio', $post_id ); if ( empty( $audios ) ) return; $audio = reset( $audios ); $src = wp_get_attachment_url( $audio->ID ); if ( empty( $src ) ) return; array_unshift( $default_types, 'src' ); } $library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' ); if ( 'mediaelement' === $library && did_action( 'init' ) ) { wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-mediaelement' ); } $atts = array( 'class' => apply_filters( 'wp_audio_shortcode_class', 'wp-audio-shortcode' ), 'id' => sprintf( 'audio-%d-%d', $post_id, $instances ), 'loop' => $loop, 'autoplay' => $autoplay, 'preload' => $preload, 'style' => 'width: 100%', ); // These ones should just be omitted altogether if they are blank foreach ( array( 'loop', 'autoplay', 'preload' ) as $a ) { if ( empty( $atts[$a] ) ) unset( $atts[$a] ); } $attr_strings = array(); foreach ( $atts as $k => $v ) { $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; } $html = ''; if ( 'mediaelement' === $library && 1 === $instances ) $html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n"; $html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) ); $fileurl = ''; $source = '<source type="%s" src="%s" />'; foreach ( $default_types as $fallback ) { if ( ! empty( $$fallback ) ) { if ( empty( $fileurl ) ) $fileurl = $$fallback; $type = wp_check_filetype( $$fallback, wp_get_mime_types() ); $html .= sprintf( $source, $type['type'], esc_url( $$fallback ) ); } } if ( 'mediaelement' === $library ) $html .= wp_mediaelement_fallback( $fileurl ); $html .= '</audio>'; return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );}add_shortcode( 'audio', 'wp_audio_shortcode' );/** * Return a filtered list of WP-supported video formats * * @since 3.6.0 * @return array */function wp_get_video_extensions() { return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) );}/** * The Video shortcode. * * This implements the functionality of the Video Shortcode for displaying * WordPress mp4s in a post. * * @since 3.6.0 * * @param array $attr Attributes of the shortcode. * @param string $content Optional. Shortcode content. * @return string HTML content to display video. */function wp_video_shortcode( $attr, $content = '' ) { global $content_width; $post_id = get_post() ? get_the_ID() : 0; static $instances = 0; $instances++; /** * Override the default video shortcode. * * @since 3.7.0 * * @param null Empty variable to be replaced with shortcode markup. * @param array $attr Attributes of the shortcode. * @param string $content Shortcode content. * @param int $instances Unique numeric ID of this video shortcode instance. */ $html = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instances ); if ( '' !== $html ) return $html; $video = null; $default_types = wp_get_video_extensions(); $defaults_atts = array( 'src' => '', 'poster' => '', 'loop' => '', 'autoplay' => '', 'preload' => 'metadata', 'height' => 360, 'width' => empty( $content_width ) ? 640 : $content_width, ); foreach ( $default_types as $type ) $defaults_atts[$type] = ''; $atts = shortcode_atts( $defaults_atts, $attr, 'video' ); extract( $atts ); $w = $width; $h = $height; if ( is_admin() && $width > 600 ) $w = 600; elseif ( ! is_admin() && $w > $defaults_atts['width'] ) $w = $defaults_atts['width']; if ( $w < $width ) $height = round( ( $h * $w ) / $width ); $width = $w; $primary = false; if ( ! empty( $src ) ) { $type = wp_check_filetype( $src, wp_get_mime_types() ); if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $src ), esc_html( $src ) ); $primary = true; array_unshift( $default_types, 'src' ); } else { foreach ( $default_types as $ext ) { if ( ! empty( $$ext ) ) { $type = wp_check_filetype( $$ext, wp_get_mime_types() ); if ( strtolower( $type['ext'] ) === $ext ) $primary = true; } } } if ( ! $primary ) { $videos = get_attached_media( 'video', $post_id ); if ( empty( $videos ) ) return; $video = reset( $videos ); $src = wp_get_attachment_url( $video->ID ); if ( empty( $src ) ) return; array_unshift( $default_types, 'src' ); } $library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' ); if ( 'mediaelement' === $library && did_action( 'init' ) ) { wp_enqueue_style( 'wp-mediaelement' ); wp_enqueue_script( 'wp-mediaelement' ); } $atts = array( 'class' => apply_filters( 'wp_video_shortcode_class', 'wp-video-shortcode' ), 'id' => sprintf( 'video-%d-%d', $post_id, $instances ), 'width' => absint( $width ), 'height' => absint( $height ), 'poster' => esc_url( $poster ), 'loop' => $loop, 'autoplay' => $autoplay, 'preload' => $preload, ); // These ones should just be omitted altogether if they are blank foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) { if ( empty( $atts[$a] ) ) unset( $atts[$a] ); } $attr_strings = array(); foreach ( $atts as $k => $v ) { $attr_strings[] = $k . '="' . esc_attr( $v ) . '"'; } $html = ''; if ( 'mediaelement' === $library && 1 === $instances ) $html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n"; $html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) ); $fileurl = ''; $source = '<source type="%s" src="%s" />'; foreach ( $default_types as $fallback ) { if ( ! empty( $$fallback ) ) { if ( empty( $fileurl ) ) $fileurl = $$fallback; $type = wp_check_filetype( $$fallback, wp_get_mime_types() ); // m4v sometimes shows up as video/mpeg which collides with mp4 if ( 'm4v' === $type['ext'] ) $type['type'] = 'video/m4v'; $html .= sprintf( $source, $type['type'], esc_url( $$fallback ) ); } } if ( 'mediaelement' === $library ) $html .= wp_mediaelement_fallback( $fileurl ); $html .= '</video>'; $html = sprintf( '<div style="width: %dpx; max-width: 100%%;">%s</div>', $width, $html ); return apply_filters( 'wp_video_shortcode', $html, $atts, $video, $post_id, $library );}add_shortcode( 'video', 'wp_video_shortcode' );
Именно!
----------
Ещё вот этот полезный фильтр добавили: ajax_query_attachments_args
-------
Тоже приятная возможность: http://wphooks.info/filters/posts_search_orderby/
Да, та же фигня, но у меня 10300пикс. Было бы веселее со 100500 :D
Походу, JS косячит, ибо в инлайн стайле:
---------- Добавлено 25.10.2013 в 22:12 ----------
Такого не может быть -- 100%.
Добавлено куча всего.---------- Добавлено 25.10.2013 в 22:19 ----------Для себя выделил вот такие маленькие вкусности в версии 3.7, упрощающие кастомайз ВордПресса:
img_caption_shortcode_width
Находится в \wp-includes\media.php
add_shortcode('wp_caption', 'img_caption_shortcode'); add_shortcode('caption', 'img_caption_shortcode'); /** * The Caption shortcode. * * Allows a plugin to replace the content that would otherwise be returned. The * filter is 'img_caption_shortcode' and passes an empty string, the attr * parameter and the content parameter values. * * The supported attributes for the shortcode are 'id', 'align', 'width', and * 'caption'. * * @since 2.6.0 * * @param array $attr Attributes attributed to the shortcode. * @param string $content Optional. Shortcode content. * @return string */ function img_caption_shortcode($attr, $content = null) { // New-style shortcode with the caption inside the shortcode with the link and image tags. if ( ! isset( $attr['caption'] ) ) { if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) { $content = $matches[1]; $attr['caption'] = trim( $matches[2] ); } } // Allow plugins/themes to override the default caption template. $output = apply_filters('img_caption_shortcode', '', $attr, $content); if ( $output != '' ) return $output; $atts = shortcode_atts( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '' ), $attr, 'caption' ); $atts['width'] = (int) $atts['width']; if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) return $content; if ( ! empty( $atts['id'] ) ) $atts['id'] = 'id="' . esc_attr( $atts['id'] ) . '" '; $caption_width = 10 + $atts['width']; /** * Filter the width of an image's caption. * * By default, the caption is 10 pixels greater than the width of the image, * to prevent post content from running up against a floated image. * * @since 3.7.0 * * @param int $caption_width Width in pixels. To remove this inline style, return zero. * @param array $atts { * The attributes of the caption shortcode. * * @type string 'id' The ID of the div element for the caption. * @type string 'align' The class name that aligns the caption. Default 'alignnone'. * @type int 'width' The width of the image being captioned. * @type string 'caption' The image's caption. * } * @param string $content The image element, possibly wrapped in a hyperlink. */ $caption_width = apply_filters( 'img_caption_shortcode_width', $caption_width, $atts, $content ); $style = ''; if ( $caption_width ) $style = 'style="width: ' . (int) $caption_width . 'px" '; return '<div ' . $atts['id'] . $style . 'class="wp-caption ' . esc_attr( $atts['align'] ) . '">' . do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>'; }
Щас ещё напишу, ждём. :D
Верно.
Ещё бы я посоветовал ТС не грузить отдельно мелкие картинки подобные сабжевым, а использовать спрайты. На будущее.