Support » Fixing WordPress » Child theme or not?

  • Hi,

    I’m seeing lot of videos explaining child theme, but it’s all about CSS. My question is why using Child Theme instead of a custom css plugin or edit css in the theme edit options?

    Also, my goal is to edit a bit of the html code to kind of add my own style to the website, so I will need to access PHP… Do PHP modifications work in a child theme or I really need to edit in the theme itself?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    Child themes are specifically for modifying theme files, not just the CSS, so it sounds like exactly what you need.

    A child theme is basically a changes-only theme that sits on top of a parent theme. That way, the parent theme can be updated (security and bug fixes, for example) without losing any of the changes you made.

    For details, see https://developer.wordpress.org/themes/advanced-topics/child-themes/ and https://themeshaper.com/modify-wordpress-themes/

    (and yes, if you were only editing CSS, just use the Additional CSS option built into WordPress’s Customizer)

    Thank you, so I read about functions.php.
    I would like to add a square around my homepage… so in Home.php if there is something like that. So I need to actually copy paste all Home.php from parent? If parent get an update, I will not receive a home.php update right?

    Thx

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator

    You can probably just do that with a border via CSS, but if not then yes you would copy the whole home.php file into the child theme and edit the child theme’s copy.

    Just strolling through the forums as I’m checking if a question of mine gets answered, and I saw the present discussion.

    Unless things changed since the last time I looked at child themes in 2016, I think a mention should be added, there is a time consumption and maintenance toll if you go into child theming.

    Imagine file.php (random name) gets updated within your theme with wordpress updates. You will have to once again copy-paste-and-then-tweak this file.php into your child theme to benefit from the updates. And it’s mandatory, since sometimes it’s not mere improvements but security updates.

    Sure it’s no big work, but it’s, still, added work and if there are multiple updates in a year you’ll start to resent it.

    Long story short, if you can achieve what you want through CSS, better do it that way, it doesn’t imply added work every now and then.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Child theme or not?’ is closed to new replies.