Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

tamw-wnet
Copy link

@tamw-wnet tamw-wnet commented May 20, 2020

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.

@tamw-wnet tamw-wnet marked this pull request as ready for review May 20, 2020 16:55
@tamw-wnet
Copy link
Author

Noting that the build failure is because the Travis integration seems to be broken -- each build failed setting up the build environment (rather than this pull req):
$ mysql -e "CREATE DATABASE wordpress_tests;" -uroot

@tamw-wnet tamw-wnet marked this pull request as draft June 17, 2020 15:18
@tamw-wnet tamw-wnet changed the title import externalAssets from a story into postmeta import externalAssets and htmlAssets from a story into postmeta Jun 17, 2020
@tamw-wnet tamw-wnet marked this pull request as ready for review June 17, 2020 15:26
@tamw-wnet tamw-wnet marked this pull request as draft July 6, 2020 18:32
@tamw-wnet
Copy link
Author

withdrawing this, I'm taking a different approach that will allow inline placement of the assets in the post.

@tamw-wnet tamw-wnet closed this Jul 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant