forked from ampproject/amp-wp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'revert/amp-actions-abstraction' (ampproject#858) into a…
…dd/849-paired-mode-templates
- Loading branch information
Showing
10 changed files
with
225 additions
and
295 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,28 @@ | ||
<?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() { | ||
|
||
/** | ||
* Filters whether to show the amphtml link on the frontend. | ||
* | ||
* @since 0.2 | ||
*/ | ||
if ( false === apply_filters( 'amp_frontend_show_canonical', true ) ) { | ||
return; | ||
} | ||
|
||
$amp_url = amp_get_permalink( get_queried_object_id() ); | ||
printf( '<link rel="amphtml" href="%s">', esc_url( $amp_url ) ); | ||
} |
Oops, something went wrong.