USharing
开放博客

single and archove php

single.php

<?php
if (get_post_type() === 'post') {
    get_template_part('views/blog/_');
} else if (get_post_type() === 'product-category') {
    get_template_part('views/category/_');
} else if (get_post_type() === 'product-model') {
    get_template_part('views/model/_');
} else if (get_post_type() === 'buy-record') {
    get_template_part('views/buy-record/_');
} else if (get_post_type() === 'customer-voice') {
    get_template_part('views/customer-voice/_');
} else {
    get_template_part('views/404/_');
}
?>

archive.php

<?php
if (get_post_type() === 'post') {
    get_template_part('views/blog/list');
} else if (get_post_type() === 'buy-record') {
    get_template_part('views/buy-record/list');
} else if (get_post_type() === 'customer-voice') {
    get_template_part('views/customer-voice/list');
} else {
    get_template_part('views/404/_');
}
?>

 

赞(0) 打赏
未经允许不得转载:USharing » single and archove php

觉得文章有用就打赏一下文章作者

微信扫一扫打赏