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.

  • Why is this needed and will this not affect other RSS readers and what about feed validation? – birgire Aug 21 '17 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? – Udit Pathak Aug 22 '17 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 Aug 22 '17 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 – Udit Pathak Aug 22 '17 at 10:37
  • I posted a suggestion with some function references – birgire Aug 22 '17 at 14:55
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, privacy policy and cookie policy

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