Skip to content

Commit

Permalink
Merge pull request #858 from Automattic/revert/amp-actions-abstraction
Browse files Browse the repository at this point in the history
Revert #725: Abstract notion of AMP Actions
  • Loading branch information
westonruter authored Jan 13, 2018
2 parents ed5594b + 13bbfab commit f9eba05
Show file tree
Hide file tree
Showing 8 changed files with 202 additions and 237 deletions.
7 changes: 4 additions & 3 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,13 @@ function amp_load_classes() {
}

function amp_add_frontend_actions() {
AMP_Frontend_Actions::register_hooks();
require_once AMP__DIR__ . '/includes/amp-frontend-actions.php';
}

function amp_add_post_template_actions() {
AMP_Paired_Post_Actions::register_hooks();
require_once( AMP__DIR__ . '/includes/amp-post-template-functions.php' );
require_once AMP__DIR__ . '/includes/amp-post-template-actions.php';
require_once AMP__DIR__ . '/includes/amp-post-template-functions.php';
amp_post_template_init_hooks();
}

function amp_prepare_render() {
Expand Down
20 changes: 0 additions & 20 deletions includes/actions/class-amp-actions.php

This file was deleted.

32 changes: 0 additions & 32 deletions includes/actions/class-amp-frontend-actions.php

This file was deleted.

178 changes: 0 additions & 178 deletions includes/actions/class-amp-paired-post-actions.php

This file was deleted.

28 changes: 28 additions & 0 deletions includes/amp-frontend-actions.php
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 ) );
}
Loading

0 comments on commit f9eba05

Please sign in to comment.