Okay
  Public Ticket #260014
Child Theme Function
Closed

Comments

  • Christopher started the conversation

    Hi. I'm trying to add a form function to the child theme function.php, but I'm not successful. What am I doing wrong? The code is: <?php formcraft(1,'sticky',,'Click Here');?>

    Once I place the code, the whole site crashes. Please help. Thanks.

  • Christopher replied

    Update: I've got it to work when I placed it in the Parent Theme's footer.php. This is probably not the best place to put it since the theme will be updated and the footer.php will be replaced. 

    So how can I put this in the footer.php (so the form is on every page) in the child theme?

    Thanks.

  •  8,839
    Tahir replied

    Hey Christopher!

    Copy and paste the footer.php inside the child theme and it should work. The child theme footer.php would be called first and then the parents. 

    Thanks


    ThemeNectar Support Team 

  • Christopher replied

    Hi. Thanks for your repy.

    1. Do I copy the whole footer.php? If so, then when the theme is updated, I would have to copy the new footer.php to the child theme and modify it again? Is there a way to just put only the needed code in there so that in the future I won't have to touch the parent footer.php? 

    2. Could you tell me how to include this code in the footer.php on every page except the home page: <?php formcraft(1,'sticky',,'Click Here');?>

    Thanks again!

  •  8,839
    Tahir replied

    Hey !

    1. Yes you need to copy the whole footer.php.  Usually the footer.php is not changed in updates so you would be good in future as well. 

    2. You would have to check for the home page using wp builtin function is_page and then run the form. You can find examples if you google for "wordpress is_page" . 

    All the Best,

    -T


    ThemeNectar Support Team 

  • Christopher replied

    Thanks.