Last active
July 21, 2016 17:54
-
-
Save johnregan3/59c83ab27b7d5319a174624f66ec2067 to your computer and use it in GitHub Desktop.
Registering a Custom Post Type with the WP AMP plugin
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 | |
/** | |
* Register CPTs to be included with AMP integration. | |
* | |
* Be sure to visit Settings > Permalinks and save twice | |
* to ensure the rewrite rules are flushed after adding this. | |
* | |
* @action amp_init | |
*/ | |
function jr3_amp_register_post_types() { | |
if ( ! defined( 'AMP_QUERY_VAR' ) ) { | |
define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) ); | |
} | |
add_post_type_support( 'book', AMP_QUERY_VAR ); | |
} | |
add_action( 'amp_init', 'jr3_amp_register_post_types' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment