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.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744687576a4588013.html
评论列表(0条)