admin管理员组文章数量:1392059
I've developed some twentynineteen-child template. Today, I need to convert my last child-template into a template stand-alone.
I removed the following line from the style.css file:
Template: twentynineteen
And added a few lines to my functions.php file:
if ( ! function_exists( 'oripeau_setup' ) ) :
function oripeau_setup() {
load_theme_textdomain( 'oripeau', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'oripeau' ),
'secondary' => __('Secondary Menu', 'oripeau' )
) );
add_theme_support( 'post-formats', array ( 'aside', 'gallery', 'quote', 'image', 'video' ) );
}
endif;
add_action( 'after_setup_theme', 'oripeau_setup' );
I renamed the template folder:
wp-content/themes/oripeau
But echo get_template_directory_uri() still output
/wp-content/themes/twentynineteen
Question: what am I forgetting?
I've developed some twentynineteen-child template. Today, I need to convert my last child-template into a template stand-alone.
I removed the following line from the style.css file:
Template: twentynineteen
And added a few lines to my functions.php file:
if ( ! function_exists( 'oripeau_setup' ) ) :
function oripeau_setup() {
load_theme_textdomain( 'oripeau', get_template_directory() . '/languages' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'post-thumbnails' );
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'oripeau' ),
'secondary' => __('Secondary Menu', 'oripeau' )
) );
add_theme_support( 'post-formats', array ( 'aside', 'gallery', 'quote', 'image', 'video' ) );
}
endif;
add_action( 'after_setup_theme', 'oripeau_setup' );
I renamed the template folder:
wp-content/themes/oripeau
But echo get_template_directory_uri() still output
/wp-content/themes/twentynineteen
Question: what am I forgetting?
Share Improve this question asked Mar 7, 2020 at 22:30 Rémi B. LOIZEAURémi B. LOIZEAU 311 bronze badge 2- You need to deactivate and reactivate your theme. – Jacob Peattie Commented Mar 8, 2020 at 2:12
- Brilliant! It's working. Thank you so much. – Rémi B. LOIZEAU Commented Mar 8, 2020 at 14:36
1 Answer
Reset to default 1You need to deactivate and reactivate your theme.
When a theme is activated the template
and stylesheet
values are set in the database. If you remove Template:
from the child theme's stylesheet, the template
is still set to twentynineteen
in the database, so get_template_directory_uri()
will return its URL. Re-activating the theme will ensure that this isn't set to the wrong theme anymore.
本文标签: Why ltphp echo gettemplatedirectoryuri() gt still output wpcontentthemestwentynineteen
版权声明:本文标题:Why <?php echo get_template_directory_uri() ?> still output wp-contentthemestwentynineteen? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744687576a2619796.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论