0

I have a website that is listed in UCnews.

They are asking me to change the regular <iframe> structure to

<res-iframe type="video" data-src="video address" data-title="title"></res-iframe>

I have been trying but there is no specific link or studybase to help with such issue.

5
  • Why is this needed and will this not affect other RSS readers and what about feed validation?
    – birgire
    Commented Aug 21, 2017 at 8:26
  • This is needed to display the video as a video in the UCnews feed as this shows in the feed just as an image. If i am able to add the res-iframe them the video will also be visible in their feed and other feeds will not be affected. is this possible? Commented Aug 22, 2017 at 9:07
  • If you change all iframes to non-standard res-iframes then those that are using your RSS feed, directly from your site, will be affected.
    – birgire
    Commented Aug 22, 2017 at 9:26
  • If i can, should both the frames be added? Then UC will be able to render video on ts feed and other feeds wont be affected. Can we do this? Could you please tell me a resource that helps with rss modifications as I am unable to find one good source. Thanks Commented Aug 22, 2017 at 10:37
  • I posted a suggestion with some function references
    – birgire
    Commented Aug 22, 2017 at 14:55

1 Answer 1

0

I think it would be better to create a custom feed, for such modifications.

That way, the default feed is unaffected.

We can look at how add_feed() works and where to hook it.

Add a custom one, like: add_feed( 'ucnews', '...some custom callback...' );

There exists e.g. the core do_feed_rss2() function, that loads the default rss2 template:

load_template( ABSPATH . WPINC . '/feed-rss2.php' );

There the <content:encoded> tag gets it's value from get_the_content_feed(), so we can filter it with the_content_feed.

That way we can filter the content, only for that feed, e.g. with the help from a is_feed( 'ucnews' ) check.

Note that one needs to flush the rewrite rules, for the custom feed rules to be activated.

It's also not clear if this is for all iframes, or only specific ones!

I'm not sure how effective a preg_replace would be, in this case, so you might try a shortcode approach instead, where the output could depend on the context.

Hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.