Skip to content

Instantly share code, notes, and snippets.

@MohammedKaludi
Last active May 30, 2017 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MohammedKaludi/78088ecd9269a4c38bb759909a0f9970 to your computer and use it in GitHub Desktop.
Save MohammedKaludi/78088ecd9269a4c38bb759909a0f9970 to your computer and use it in GitHub Desktop.
AMPforWP Custom Header file code
<?php
// Remove Old File
add_action('init','ampforwp_remove_old_header_file',11);
function ampforwp_remove_old_header_file(){
remove_filter( 'amp_post_template_file', 'ampforwp_custom_header', 10, 3 );
}
// Register New Files
add_action('init','ampforwp_custom_header_files_register', 10);
function ampforwp_custom_header_files_register(){
add_filter( 'amp_post_template_file', 'ampforwp_custom_header_file', 10, 2 );
}
// Add Custom Header File
function ampforwp_custom_header_file( $file, $type ) {
if ( 'header-bar' === $type ) {
$file = plugin_dir_path( __FILE__ ) . '/template/header-bar.php';
}
return $file;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment