Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Enable landscape (desktop) support for stories that have the 'landscape' tag. Requires AMP plugin 1.2+.
<?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
);
@jdelia

This comment has been minimized.

Copy link

jdelia commented Aug 6, 2019

Thank you. This provides a useful feature in our testing of AMP Stories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.