Last active
August 6, 2019 17:39
-
-
Save westonruter/4e4ee2b5790c6218fab40a7b3f90331f to your computer and use it in GitHub Desktop.
Enable landscape (desktop) support for stories that have the 'landscape' tag. Requires AMP plugin 1.2+.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: AMP Story Supports Landscape | |
* | |
* @package AMP_Story_Supports_Landscape | |
* @author Weston Ruter, Google | |
* @license GPL-2.0-or-later | |
* @copyright 2019 Google Inc. | |
* | |
* @wordpress-plugin | |
* Plugin Name: AMP Story Supports Landscape | |
* Description: Enable landscape (desktop) support for stories that have the 'landscape' tag. | |
* Plugin URI: https://gist.github.com/westonruter/2ea25735be279b88c6f0946629d0240c | |
* Version: 0.1.0 | |
* Author: Weston Ruter, Google | |
* Author URI: https://weston.ruter.net/ | |
* License: GNU General Public License v2 (or later) | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
add_filter( | |
'amp_story_supports_landscape', | |
function ( $supports, $post ) { | |
if ( has_tag( 'landscape', $post ) ) { | |
$supports = true; | |
} | |
return $supports; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. This provides a useful feature in our testing of AMP Stories.