Overriding the functions.php parent file in a child theme

  • Home
  • Forums
  • Dokan
  • Overriding the functions.php parent file in a child theme
This topic contains 7 reply and 3 voices, and was last updated by Nayem 9 years, 3 months ago
Viewing 7 Posts - 1 through 7 (of 7 total)
Author Posts
December 3, 2014 at 6:03 pm 31718
Nayem Hi, I would love to know if there is a way that i can override the parent functions.php file in a child theme. I have installed the Dokan plugin and the theme too, but i would love to override some of the functionalities in the functions.php file, I don't won't to do that in the parent file in order to get all the updates and all the new features. And can you tell me what are the required files that i have to put in my child theme in order to make it work properly. For example, the file that I want to override is the template-tags.php file, this file is being called from the functions.php file, and there are more stuff that I want to customize too. Thanks.
December 3, 2014 at 7:07 pm 31721
Nayem Nayem

Hello Hovsep,

In your child theme you have to maintain the file order of the main theme. You can use any file which you want to customize but you have to maintain the same file order as main theme. Hope you got it.

Thank you 🙂

December 3, 2014 at 8:51 pm 31730
Hovsep Hovsep

I’m doing that but it’s not working, i have figure out why but i can’t fix it.
The file that i’m talking about is beeing called from the parent function.php file, so it always loading the parent file, when i do the same in my child theme, i’m getting a duplication error…can you help ?

December 4, 2014 at 1:30 pm 31800
Sekander Badsha Sekander Badsha

Hello Hovsep,

Can you please tell us exactly which function you want to override?
It would be easy for us to instruct you can be more specific.

December 9, 2014 at 5:42 pm 32046
Hovsep Hovsep

Basically what I’m trying to do is the following:
the dokan theme has a top right menu which in it we have the sign up button and the and login and the cart if you are not signed in, so let’s call that the top menu…. What I want to do is bring that menu from the top and include it in to my main menu, so I will have my menu and the dokan theme user menu as one.
in order to do this I have located where the code is and included it to my menu, the function was dokan_header_user_menu(), so I want to remove the ‘ul’ tags from this menu in order to style the menu properly, and have more control on how it’s going to behave.
I don’t want to chage the main dokan theme files cuz it have a lot of features that I want to use, so I wanna know if there is a way that I can override the template-tags.php file, which has the dokan_header_user_menu() function.
thanks

December 10, 2014 at 11:07 am 32073
Nayem Nayem

Hello Hovsep,

Please follow the following instruction-

1. Copy header.php file from the parent theme and paste it to your child theme.
2. You have to copy this function dokan_header_user_menu() to child themes function.php and change the name of this function name as you want. You can do whatever you want to do with this function.
3. Now you have to open your child theme’s header.php file then you have to replace this function dokan_header_user_menu() to your new function which you have changed in function.php.

Please check and let me know. Thank you 🙂

December 12, 2014 at 7:45 pm 32212
Hovsep Hovsep

thanks a lot, it works.

December 12, 2014 at 7:47 pm 32213
Nayem Nayem

Hello Hovsep,

Very glad to know that. If you have no more problem then please mark this topic as resolved.

Thank you 🙂

Viewing 7 Posts - 1 through 7 (of 7 total)