Skip to content

Commit

Permalink
Merge branch 'revert/amp-actions-abstraction' (ampproject#858) into a…
Browse files Browse the repository at this point in the history
…dd/849-paired-mode-templates
  • Loading branch information
westonruter committed Jan 13, 2018
2 parents 184e89a + 13bbfab commit a378cd5
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 295 deletions.
9 changes: 5 additions & 4 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function amp_maybe_add_actions() {
if ( amp_is_canonical() || is_amp_endpoint() ) {
AMP_Theme_Support::init();
} else {
AMP_Frontend_Actions::register_hooks();
amp_add_frontend_actions();
}
return;
}
Expand Down Expand Up @@ -196,12 +196,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.

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

This file was deleted.

176 changes: 0 additions & 176 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 a378cd5

Please sign in to comment.