Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
themes-topic
Child themes and custom function
Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Dec 22, 2014 - 12:19 pm

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?

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 22, 2014 - 12:21 pm

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...

Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Dec 22, 2014 - 3:42 pm

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.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 22, 2014 - 3:45 pm

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

Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Dec 22, 2014 - 4:25 pm

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();
?>
Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Dec 22, 2014 - 4:54 pm

I tried and it did not work. rolleys

Please guide me guys! smile

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Dec 22, 2014 - 6:11 pm

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...

Avatar
Meztli
Sweden
Member
sp_UserOfflineSmall Offline
Dec 23, 2014 - 5:31 am

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!

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Dec 23, 2014 - 9:36 am

Hope all is now well and as you want it.

Happy Christmas to you indeed.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 649
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 616
Members: 17344
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10117
Posts: 79600