$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Newbie Question: can I change a theme's section without hard coding?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Newbie Question: can I change a theme's section without hard coding?

matteradmin8PV0评论

Just started to try wordpress, not as easy as I thought it would be, maybe it is just that I am too used to Joomla?

Anyway, I was working on the default theme "Twenty Seventeen". It has a fullscreen picture at its landing screen, which is called "header media". For learning purpose, I want to change this section to a "custom html" just like in Joomla. But I couldn't find where to do this. So how do I do it? It seems to be something that is fixed in the theme and you can't change it without hardcoding PHP files, am I right?

Just started to try wordpress, not as easy as I thought it would be, maybe it is just that I am too used to Joomla?

Anyway, I was working on the default theme "Twenty Seventeen". It has a fullscreen picture at its landing screen, which is called "header media". For learning purpose, I want to change this section to a "custom html" just like in Joomla. But I couldn't find where to do this. So how do I do it? It seems to be something that is fixed in the theme and you can't change it without hardcoding PHP files, am I right?

Share Improve this question asked Mar 1, 2019 at 3:02 shenkwenshenkwen 1311 silver badge9 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can hard-code it to PHP file, but you don't have to edit the original theme files. Instead, you can create a child theme.

First, you create a folder and name it to your liking. For example my-theme Then create a style.css file inside that folder.

At the very top of that CSS file, you write this code:

/*
Theme Name: My Theme
Template: twentyseventeen
*/

Now you should be able to activate that theme from the administration area.

To override a theme file, you just need to create a file with the same name as the original one, inside your theme directory.

Post a comment

comment list (0)

  1. No comments so far