Changing the size of youtube video in excerpt
-
Hi,
I’m using the following code to get a youtube video in my excerpt:
// Custom Excerpt
function custom_wp_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
$text = get_the_content(''); // Original Content
$text = strip_shortcodes($text); // Minus Shortcodes
$text = apply_filters('the_content', $text); // Filters
$text = str_replace(']]>', ']]>', $text); // Replace$excerpt_length = apply_filters('excerpt_length', 55); // Length
$excerpt_more = apply_filters('excerpt_more', ' ' . '»');
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );// Use First Video as Excerpt
$postcustom = get_post_custom_keys();
if ($postcustom){
$i = 1;
foreach ($postcustom as $key){
if (strpos($key,'oembed')){
foreach (get_post_custom_values($key) as $video){
if ($i == 1){
$text = $video.$text;
}
$i++;
}
}
}
}
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'custom_wp_trim_excerpt');And currently the youtube video comes out at its normal height in the excerpt, how could I change the height of the video in the excerpt without changing the height of the video in the post itself?
Thanks a lot for your help,
TomThe blog I need help with is: (visible only to logged in users)
-
The blog you specified at motivationrepublic.com does not appear to be hosted at WordPress.com.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘Changing the size of youtube video in excerpt’ is closed to new replies.