-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #856 from Automattic/add/849-paired-mode-templates
Add paired mode custom templates
- Loading branch information
Showing
14 changed files
with
387 additions
and
322 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
/** | ||
* Callbacks for adding AMP-related things to the main theme. | ||
* | ||
* @package AMP | ||
*/ | ||
|
||
add_action( 'wp_head', 'amp_frontend_add_canonical' ); | ||
|
||
/** | ||
* Add amphtml link to frontend. | ||
* | ||
* @since 0.2 | ||
*/ | ||
function amp_frontend_add_canonical() { | ||
|
||
// Prevent showing amphtml link if theme supports AMP but paired mode is not available. | ||
if ( current_theme_supports( 'amp' ) && ! AMP_Theme_Support::is_paired_available() ) { | ||
return; | ||
} | ||
|
||
/** | ||
* Filters whether to show the amphtml link on the frontend. | ||
* | ||
* @since 0.2 | ||
*/ | ||
if ( false === apply_filters( 'amp_frontend_show_canonical', true ) ) { | ||
return; | ||
} | ||
|
||
printf( '<link rel="amphtml" href="%s">', esc_url( amp_get_permalink( get_queried_object_id() ) ) ); | ||
} |
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
Oops, something went wrong.