0

i am taking a hard time to figure how to do it. I have three different pages in my wordpress installation besides the Homepage. I need to edit each one of them separately, remove header, footer and do some other stuff. The thing is that i dont know where are those pages source code files in wordpress directory in order to edit them.

4 Answers 4

1

Much of the code for any page, including header and footer, comes from your theme.

If you want to create fully custom code, your best bet is to create a child theme (which just means creating a "style.css" file with some comments that refer to the parent theme, which is what you're currently using) and inside the child theme, create custom templates. It's there where you can add your own HTML and a loop to grab the content for each page (the part you edit in wp-admin).

4
  • I just need to customize three inner pages. How do i create this child theme? Jan 16, 2020 at 15:05
  • WP documentation would be a good place to start. As I mentioned you just need to create a style.css file with brief comments.
    – WebElaine
    Jan 16, 2020 at 15:35
  • I have created the child theme and now i am going to customize it. However, i was wandering how to link a button, for example, to a specific page of the child theme. Jan 17, 2020 at 17:09
  • You can't. All of the files in the child theme are templates - see the WP Template Hierarchy. There's usually one template for Pages, one for Posts, and so on and so forth. So, you create the content in the wp-admin Editor as Pages, Posts, or a custom post type, and the template files in the theme add the wrapper HTML and any CSS and JS you wish to include (plus CSS and JS from plugins).
    – WebElaine
    Jan 17, 2020 at 19:45
1

As mentioned elsewhere here, the display of your posts/pages depends on the theme that you are using. And making changes to the theme's code is not recommended, as any changes will be overwritten with a theme update. That's why you would create and activate a Child Theme to make changes. (Although you can make simple CSS changes via Admin, Themes, Customization, Additional CSS screen.)

But if you really want to know how to change a specific look of a page, without changing the theme, Child Themes is what you want to do. Then you can add your customized page code to modify how things look.

For this, you need to understand how themes work, and how they are 'built'. You should start here: https://developer.wordpress.org/themes/ . Then, look at 'theme hierarchy' to understand what theme template file is used to 'build' the post/page. There are also manu google/bings/ducks on how to build themes, create Child Themes, and the theme hierarchy.

1

Rather than editing Wordpress or your theme's source code you're better off using the "Additional CSS" option found while customizing your theme appearance within the admin menu.

Using Google Chrome or similar, load your up page, right click on the header region then select "Inspect". You will see on the left of your screen the CSS styles associated with your page.

In my case the header was called "header-layout-1". Yours might be different.

While editing the "Additional CSS" add the following line;

.header-layout-1 {display:none;}

Save your changes and reload your page. Your header should be gone.

Follow the same steps for the footer or anything else you don't want displayed.

More information from Wordpress

0

Open up the root directory of your Wordpress folder and then navigate to wp-content/themes/ to see all the installed themes. Select the theme you're using and that folder will contain all theme specific code, including template files.

2
  • accessing the directory you've mentioned, i just find page.php, single.php and index.php but not my other pages. Jan 16, 2020 at 15:07
  • 1
    Under the hood, those are the template files which render your pages. Without knowing what you’re seeing or what theme you’re using the best I can do is tell you to read up on Wordpress’s template hierarchy at developer.wordpress.org/themes/basics/template-hierarchy. Feel free to add the contents of those template files. Jan 16, 2020 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.