• I need to make a change to both post.php and media.php to grab images from a hosted solution elsewhere and I want to avoid those changes getting overwritten when WordPress gets updated. I know with themes I can create a child theme, but how do I do this with post.php and media.php? If that isn’t possible, how do I change WordPress so that it looks for the images on the image host I am using rather than in the wp-content folder?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Phil

    (@websterwebguru)

    Hello Mike,

    So you are correct that you want to create a child theme. Which only really requires the style.css file. But, you also want to add post.php and media.php to your child theme folder. Any file you add to the child theme will not be overwritten when the parent theme gets updated. You should also have a functions.php in the child theme and enqueue the style sheet from the parent theme (instead of using @import in the CSS)

    Thread Starter MikeMahony

    (@mikemahony)

    so, if post.php and media.php exist in the root of the child theme, those will take precedence over the files in wp-includes?

    SO if I have wp-content/themes/MyTheme and I create a child theme I will have wp-content/themes/MyTheme-child and inside of that folder I just add a post.php and media.php (in addition to the style.css and functions.php)?

    Phil

    (@websterwebguru)

    Yes, that is correct. Let me know how it worls out
    Phil

    Actually, that won’t work at all. There’s no way that I’m aware of to override something in wp-includes from a theme. You may need to look for a plugin to do what you’re trying to do or perhaps you can write a filter function instead.

    Thread Starter MikeMahony

    (@mikemahony)

    Thanks Phil! I appreciate all your help. Been using wordpress for some time and keep learning more and more about how to customize it.

    Phil

    (@websterwebguru)

    Mike,

    I’m not sure if I confused you, but I definitely misspoke yesterday. You definitely don’t want to modify anything in the wp-includes folder. Everything I told you about the child themes is correct, but you do not want to change anything in the wp-includes folder. What is it that you are trying to do by modifying post.php and media.php?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Modify post.php and media.php so they don't get overwritten’ is closed to new replies.