$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'); ?>Specific custom child theme page|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)

Specific custom child theme page

matteradmin9PV0评论

I'm very new to wordpress and I'm still getting my head around this. So, I'm using twentyseventeen theme but I want my front page to be just a landing page with my logo and a button to press 'Go', I dont need neither header or footer.

My idea is to copy front-page.php to my child theme folder and, being there, I change the code at my will, like removing the footer caller and the navigation menu, add the background color that I want, etc. Will I have problems with updates and is that a good practice? Because by doing this I'm basically changing all front-page code. Should I, instead, try to apply filters in the functions.php and use the style.css to, for example, hide the navigation menu?

I'm very new to wordpress and I'm still getting my head around this. So, I'm using twentyseventeen theme but I want my front page to be just a landing page with my logo and a button to press 'Go', I dont need neither header or footer.

My idea is to copy front-page.php to my child theme folder and, being there, I change the code at my will, like removing the footer caller and the navigation menu, add the background color that I want, etc. Will I have problems with updates and is that a good practice? Because by doing this I'm basically changing all front-page code. Should I, instead, try to apply filters in the functions.php and use the style.css to, for example, hide the navigation menu?

Share Improve this question edited Feb 9, 2019 at 12:06 Manuel Perdigão asked Feb 9, 2019 at 11:32 Manuel PerdigãoManuel Perdigão 133 bronze badges 1
  • I guess wordpress is new to you, not tbe other way around. – Pedro Lobito Commented Feb 9, 2019 at 14:54
Add a comment  | 

1 Answer 1

Reset to default 1

You have the right idea.

Your child theme's copy of front-page.php will take precedence over the parent theme's, with no danger of it being overwritten by updates to the theme.

You will want to make sure to also create an actual page in WordPress to represent that page, and that on the WordPress -> Settings -> Reading page in the admin interface you specify that page to use as your front page. Then that page will automatically use your front-page.php for its template (otherwise it will default to showing a page of posts, i.e. home.php).

If you run into any problems feel free to post, but you are well ahead of the average WordPress first timer and are clearly thinking carefully ahead. Good job.

Edit: By the way, I would not completely remove the get_footer() call from that file. WordPress and other plugins have a general assumption that you're going to call the header and footer function and may use them to, for instance, add script dependencies. What you can do instead is specify a specific footer template file to use, i.e. get_footer( 'blank' ) which will look for footer-blank.php. Create the file but keep it minimal. You'll want to at least close out any open HTML elements. But you don't have to do anything else with it. The same practice goes with the header, although there you'll at least want to do some basic framing structure for your HTML.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far