• Hi. I am using the theme Twenty Eleven, I asked a few days in this forum how to modify Header.php in a Twenty Eleven child theme through functions.php. Turns out that is not really possible. (or something) ‘Cause everyone just keeps telling me to modify header.php in the actual theme. I even hired a PHP programmer to do the job but he solved the problem with this lines:

    function changeimg() {
    echo "[kml_flashembed movie='http://site.com/headermovie.swf' height='320' width='1000' /]";
    }
    
     add_action('get_search_form', 'changeimg');

    Which did the trick for a moment but then the search bar turned into a flash header, which was not intended at all. On a closer inspection and using ye olde “error and trial” method I realized that no other function can be changed. Or at least it none work for me…
    …Then there is the problem that I want to change/add text in comments.php and 404.php, which according to my programmer is utterly impossible. All that made me think: Well, why don’t we just change header.php, comments.php, 404.php an so on… And here is my dilema:

    The child’s header.php will completely replace the original file, yes, updates won’t affect it but then, the last time I did that the blog was all buggy and sometimes wouldn’t load at all.
    Problem is that the new updates won’t apply on the child files and it will most likely not be compatible with the original theme when it is updated if the update is big enough to heavily affect the modified files. It may reference functions that are not described in the child copies of the files.
    So, with Twenty Eleven, what is the probability of an important malfunction if I do in fact make copies in header.php for example.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The WordPress documentation for Child Themes says:

    Making a child theme is very simple. Create a directory, put a properly formatted style.css file in it, and you have a child theme! With a little understanding of HTML and CSS, you can make that very basic child theme modify the styling and layout of a parent theme to any extent without editing the files of the parent theme itself. That way, when the parent theme is updated, your modifications are preserved.

    For this reason, child themes are the recommended way of making modifications to a theme.

    The bold text is present in the original,

    This is particularly true in the case of default themes like twentyeleven, which should never be modified except via a child theme.

    Updates to a parent theme cannot ever, AFAICT, adversely affect the child as long as the child has been set up properly:

    • The child’s style.css contains only the comment block, an @import statement and additional styles relevant to the child theme (i.e. it has not been copied from the parent).
    • Only template files that will be modified in the child are copied into the child theme (and then modified).
    • New template files for the child exist only in the child
    • The child’s functions.php file (if it exists) consists only of new or overridden functions (i.e. the parent’s functions.php file has not been copied into the child.

    Your worries are unfounded. There is no way that I can think of that the child and the parent can become incompatible. How could they be? What changes could be made to a parent template, css or functions.php file that would render the parent and child incompatible? The only possible contention that I can imagine would be if you had tried to override a parent theme function not protected by function_exists().

    Finally, if you made changes to a child theme that resulted in the theme not loading correctly, then the problem was in the child—such as trying to override a non-overrideable function.

    That’s as I see it, anyway.

    PAE

    Thread Starter redcrowdesign

    (@redcrowdesign)

    Wow! That was very clear. Thanks very much for the answer. I just have one more question. And forgive me if it’s stupid, but, how do you edit such things as the chunk that says:

    “Leave a Reply
    Your email address will not be published. Required fields are marked *”

    I just can’t find it in the code! Haven’t slept in all night trying to edit that and other text and can’t seem to find any of it. It doesn’t help either that I am not a too brilliant programmer…

    No questions are stupid. If it’s puzzling you, the chances are it’s puzzling someone else as well.

    As for the text associated with comments, in twentyeleven, the text is in the template file content.php. However, the default template for comments does not do things like mark required fields and the like. Perhaps you’re using a plugin for this, in which case the text you’re looking for will be in the plugin’s code.

    Cheers

    PAe

    Thread Starter redcrowdesign

    (@redcrowdesign)

    No, it’s not in the comments.php or any other PHP file in that folder. I used Adobe Dreamweaver to search through all the PHP files for words such as “Your email address” or “Required fields are marked”. It’s just not there. I even tried to find word by word ’cause WordPress themes sometimes fragment it and intercalate it with code.
    As for the plugin, it’s just the default text that comes with wordpress. I have quite a few plugins at work but none doing the comments for me, I do want one tho. I’ve been looking for one for 10 days now but apparently either there isn’t such plugin or I am not using the correct keywords to search for it. I’d rather change it from a plugin’s control panel than mess with the PHP’s but can’t find one that will do it for me.

    “Leave a Reply
    Your email address will not be published. Required fields are marked *”

    This text comes from WordPress core. Refer to the documentation for the comment_form() template tag.

    Thread Starter redcrowdesign

    (@redcrowdesign)

    Woah… Sounds complex LOL. Is there a plugin that can change it? I wouldn’t like to mess with the code…

    You shouldn’t ever mess with the core files unless you’re either a total super-guru or an idiot (only the first of which may be taken to refer to you, Chip). You just replace calls to core functions either with your own functions or with hard-coded values. If the function isn’t called, it doesn’t produce any output.

    But if you don’t want to mess with code at all, you’ll have to live with what the WP team have given you.

    The first paragraph may be something of an overstatement for dramatic effect, but I imagine you get the message.

    🙂

    Cheers

    PAE

    Thread Starter redcrowdesign

    (@redcrowdesign)

    My programmer is sort of a guru in PHP, but he’s not familiar with WordPress. And yeah, I wouldn’t touch ANY file that has to be hard-coded. My forte is art. By the way, for those who are curious. Site’s done and here’s how it looks:

    http://paranoidnews.org/

    Thanks everyone for your help!! 😀

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘What is the prtobability of a malfunction after update with child themes?’ is closed to new replies.