Replies: 0
So we have this to give url for new style.php:
add_filter( 'amp_post_template_file', 'xyz_amp_set_custom_template', 10, 3 );
function xyz_amp_set_custom_template( $file, $type, $post ) {
if ( 'style' === $type ) {
$file = dirname( __FILE__ ) . '/amp/style.php';
}
return $file;
}
What if I also wanted to move header-bar.php, footer.php, single.php, meta-time.php, meta-author.php, featured-image.php and all the rest of the files in the “template” folder so I can edit them without risk of overwrite.
I’m just guessing but something like:
add_filter( 'amp_post_template_file', 'xyz_amp_set_custom_template', 10, 3 );
function xyz_amp_set_custom_template( $file, $type, $post ) {
if ( 'single' === $type ) {
$file = dirname( __FILE__ ) . '/amp/single.php';
}
return $file;
}
and then
add_filter( 'amp_post_template_file', 'xyz_amp_set_custom_template', 10, 3 );
function xyz_amp_set_custom_template( $file, $type, $post ) {
if ( 'footer' === $type ) {
$file = dirname( __FILE__ ) . '/amp/footer.php';
}
return $file;
}
Something like that? Would like to just reference the editable directory in my functions file for all these temlpate files.
Cheers!
Ryan