Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3463
    martinrice
    Participant

    In the dashboard, for Theme #1 on the left which is my child theme, when I look at my functions.php file, the contents are the same as my css.style file. That’s also true for footer.php and header.php files.

    I’m afraid that if I erase the content, say, of functions.php in my child theme file to put in .php snippets, then that will change the child theme css.style file.

    Is that so?

    Thank you for your help.

    #3464
    Slavi Marinov
    Keymaster

    Hi Martin,

    Child theme’s functions.php should be empty.
    The plugin had an option to copy the file from the parent theme and this almost guaranteed site crash.
    People were trying to be lucky and took the chance and indeed their site crashed because php doesn’t allow functions with the same name to exist.
    You have to check if the parent theme’s function.php has function_exists() calls to the functions you want to change.

    You should be editing style.css from within your child theme’s folder.
    The header & footers files are exact copies of the files from the parent theme.
    You can edit those files.

    Slavi

    #3465
    martinrice
    Participant

    Hi, Slavi:

    Thanks for the response. When I set up the plugin I didn’t realize that I shouldn’t have created the php file. So I have one more question: if I want to make changes in the functions.php file, where should I do it?

    Thanks,
    Martin

    #3466
    Slavi Marinov
    Keymaster

    it should be within the child theme’s folder.

    The functions.php file should start with the php opening tag. You don’t have to close it.

    #3467
    martinrice
    Participant

    Thank you for the answer, Slavi. So if that’s where it is, then to make changes I guess I have to modify the file and then ftp it, is that right?

    Thanks again,
    Martin

    #3468
    Slavi Marinov
    Keymaster

    Hi Martin,

    You can use an FTP program if you’re comfortable with it, however, thre’s an easier way.
    Please you go to WP Admin > Appearance > Orbisius Theme Editor and you should see the double editor. With this editor you can create a new files such as functions.php file from within WordPress.
    This editor is also useful when you want to copy some piece of content from the parent theme to the child theme.

    For php related files make sure you click on check syntax button to make sure the code is correct otherwise you WILL crash your site.

    When adding functions to functions.php don’t just copy and paste functions from the parent functions.php because that WILL 100% positively crash your site.

    You want to have a block like this

    if ( ! function_exists('some_function') ) {
        function some_function() {
        }
    }

    Slavi

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.