• Resolved Immelting

    (@immelting)


    Firs of all I’m a small fry newbie.
    First of all im working with a child theme.

    I am using CS6 Dreamweaver to edit my “functin.php” file

    Once I find the scripts in the forum that I need, I copy and paste it in the the “functions.php” file I created.

    I then “filezilla – ftp” the file to my Child Themes folder.

    I then go back an check that the code is good and move on.

    Here’s my challenge…Not knowing if the parent theme, function.php sucks the child them function.php script code.

    So, when I find another php script/code, do I add (Merge) it to the existing function.php
    i.e.
    <?php Fitst Code ?>
    then add this
    <?php DO I ADD THE SECOND CODE HERE?>

    Or do I add the new code between.
    i.e.
    <?
    first code
    }
    second code
    }
    ?>
    Do create a new function.php, ftp to child theme and overwrite the existing functions.php?
    Sometime i notice that after i entered the cod and checked it ut ok, and i add another the previous code/tweak is gone.

    Sorry for the deum question.
    Deird

Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m not sure if I understand all of your question. With regard to functions.php in child theme, whatever is brought over from the parent to the child, it’s overwritten by the latter. Everything else that’s not brought over to the child’s functions.php remains the same and works both in the parent and the child.

    Thread Starter Immelting

    (@immelting)

    Thank you for your prompt response.
    My question is…
    I create a function.php
    Add
    <?php SAMPLE CODE ONE ?>
    Then decide that I want to add a second code.
    <?php SAMPLE CODE TWO ?>
    Do I merge, by just adding the code like above or do it like below, or just create new function.php file, paste SAMPLE CODE TWO, ftp the file and overwrite.
    <?php
    SAMPLE CODE ONE
    SAMPLE CODE TWO
    ?>

    Thank ypu

    Don’t create another functions.php file, one per theme is all you need. Then just add this at the top, without leaving any blank space:

    <?php

    and all your functions go after this open php tag, one after the other. No need to close and reopen the tags, unless you have a function where some HTML markup is required. In that case you close your php tag, write html markup, then reopen php tag to complete the function and/or to add other functions. If this is not clear enough, simply open a functions.php from any of the themes you have installed and see how it’s done.

    Thread Starter Immelting

    (@immelting)

    Thank you so much for you kindness and assistance.
    This enplanes why my changes were disappearing. lol
    You ROck,
    Deird

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Quick Question Regarding Child Theme – Function.php’ is closed to new replies.