This repository has been archived by the owner on Mar 26, 2021. It is now read-only.
import externalAssets and htmlAssets from a story into postmeta #69
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The "externalAssets" at the end of many stories are oembed links for YouTube and Twitter (possibly others) that are referred to in the story. Parsing those into arrays and saving them into appropriate postmeta eg 'npr_ds_oembeds_twitter'/'npr_ds_oembeds_youtube' allows them to be integrated into the WordPress posts as appropriate. They could then be retrieved like so:
$tweets = get_post_custom('npr_ds_oembeds_twitter); foreach ($tweets as $tweet) { echo (wp_oembed_get($tweet['url'])); }
YouTube videos are importable the same way, expect replace 'twitter' with 'youtube' in the example.
Similarly, the "htmlAssets" are standalone elements -- typically a div and some javascript that generate an interactive map or table. Again, this PR saves those into a postmeta with the key 'npr_html_assets' where they could be appended to the story in WordPress, eg
$htmlassets = get_post_custom('npr_html_assets'); foreach ($htmlassets as $htmlasset) { echo ($htmlasset); }
This pull request only adds functionality and does not alter any current functionality.