Last active
May 30, 2017 11:07
-
-
Save MohammedKaludi/78088ecd9269a4c38bb759909a0f9970 to your computer and use it in GitHub Desktop.
AMPforWP Custom Header file code
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
<?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