<?php 

namespace App;

/**
 * Add featured image in RSS
 */
add_filter('the_excerpt_rss', __NAMESPACE__ .'\\rss_post_thumbnail', 10, 2);
add_filter('the_content_feed', __NAMESPACE__ .'\\rss_post_thumbnail', 10, 2);
function rss_post_thumbnail($content) {
  global $post;
  if(has_post_thumbnail($post->ID)) :
    $content = '<p>' . get_the_post_thumbnail($post->ID) .
    '</p>' . get_the_content();
  endif;
  return $content;
}

/**
 * Revising Default Excerpt
 */
add_filter('excerpt_more', function ($more) {
  global $post;
  return '...';
}, 10, 2);


/**
 * Revising Default Excerpt
 */
add_filter( 'excerpt_length', function ($length) {
  return 20;
}, 10, 2 );


/**
 * Wrap oEmbed with container
 */
add_filter('embed_oembed_html', function ($html) {
  return "<div class='video-responsive'>{$html}</div>";
}, 10, 1);
