Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 512573

Move all Template Files to Include/Amp folder so can edit?

$
0
0

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


Viewing all articles
Browse latest Browse all 512573

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>