Browse Source

media attachment container :movie_camera:

windhamdavid 7 years ago
parent
commit
696522ee02
2 changed files with 33 additions and 1 deletions
  1. 15 1
      inc/tweaks.php
  2. 18 0
      single-container.php

+ 15 - 1
inc/tweaks.php

@@ -226,7 +226,7 @@ function dw_opengraph() {
 	<meta property="og:video:height" content="720" />
 	<meta property="og:video:type" content="video/mp4" />
 	<meta name="twitter:card" content="player">
-	<meta name="twitter:player" content="https://davidawindham.com/wha/container.html" />
+	<meta name="twitter:player" content="<?php echo get_permalink();?>container/" />
 	<meta name="twitter:player:width" content="1280" />
 	<meta name="twitter:player:height" content="720" />
 	<meta name="twitter:player:stream" content="<?php echo $media_url; ?>" />
@@ -241,4 +241,18 @@ function dw_opengraph() {
 add_action('wp_head', 'dw_opengraph', 5);
 
 
+function dw_read_container_endpoint(){
+	add_rewrite_endpoint( 'container', EP_PERMALINK);
+}
+add_action( 'init', 'dw_read_container_endpoint' );
+
+function dw_read_container_template( $template = '' ) {
+    global $wp_query;
+    if( ! array_key_exists( 'container', $wp_query->query_vars ) ) return $template;
+    $template = locate_template( 'single-container.php' );
+    return $template;
+}
+add_filter( 'single_template', 'dw_read_container_template' );
+
+
 ?>

+ 18 - 0
single-container.php

@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<body>
+
+<style type="text/css">
+video {  
+   width:100%; 
+   height:auto; 
+}
+</style>
+
+<video width="100%" controls>
+  <source src="<?php echo get_post_meta( get_the_ID(), 'media', true ); ?>" type="video/mp4">
+Your browser does not support video
+</video>
+
+</body>
+</html>