Support Forum

Child themes and custom function

ME Meztli
Meztli
Member

Hi guys

What about adding custom function to my child theme. Do i have to add a full copy of the parent spFunctions.php and then change it, or is it ok to add only the lines i want to change?

8 Answers

New Answer

MP Mr Papa
Mr Papa
Member

Per that child theme article I linked you to, the parent theme spFunctions.php file is included before the child theme spFunctions.php file…  so just any changes or additions that you want…

ME Meztli
Meztli
Member

Mr Papa said
Per that child theme article I linked you to, the parent theme spFunctions.php file is included before the child theme spFunctions.php file…  so just any changes or additions that you want…

I did read the article twice Steve, but english is not my native language and i was not sure if i did understand it correctly. So please be patient with me.

MP Mr Papa
Mr Papa
Member

no worries… sorry, wasnt trying to be pointed but it was a different topic so I was trying to point back to the child theme article for others that might find this topic… but then forgot the link to it rolleys

ME Meztli
Meztli
Member

I am unsure about what lines is absolutely needed as a minimum in a function file.

Lets take spHead.php as an example:

I want to change spBreadCrumbs&tree=1 to spBreadCrumbs&tree=0

Would following work as a single spHead.php file in my child theme or is it doable with less code?

<?php
# --------------------------------------------------------------------------------------
#
#    Simple:Press Template
#    Theme        :    Default
#    Template    :    head
#    Author        :    Simple:Press
#
#    The 'head' template can be used for all forum content that is to be
#    displayed at the top of every forum view page
#
# --------------------------------------------------------------------------------------

# Start Template

    # Mandatory call to sp_HeaderBegin() - available to custom code
    # ----------------------------------------------------------------------
    sp_InsertBreak();
    sp_HeaderBegin();


    # Start the 'breadCrumbs' section
    # ----------------------------------------------------------------------
    sp_SectionStart('tagClass=spPlainSection spLeft', 'breadCrumbs');
        sp_BreadCrumbs('tagClass=spLeft spBreadCrumbs&tree=0', __sp('Home'));
    sp_SectionEnd('', 'breadCrumbs');

    sp_InsertBreak();

    # Mandatory call to sp_HeaderEnd() - available to custom code
    # ----------------------------------------------------------------------
    sp_HeaderEnd();
?>
ME Meztli
Meztli
Member

I tried and it did not work. rolleys

Please guide me guys! smile

MP Mr Papa
Mr Papa
Member

you only need to copy over template files that you want to make changes too…   if you need to make any changes, you need to copy over the entire file from the parent theme to the child theme…  then make any changes…

ME Meztli
Meztli
Member

Mr Papa said
you only need to copy over template files that you want to make changes too…   if you need to make any changes, you need to copy over the entire file from the parent theme to the child theme…  then make any changes…

Great, thanks smile

Merry Christmas Steve!

YS Yellow Swordfish
Yellow Swordfish
Member

Hope all is now well and as you want it.

Happy Christmas to you indeed.