Skip to:
Content
Pages
Categories
Search
Top
Bottom

Child Theme Function PHP

  • Avatar of aldereteka
    aldereteka
    Participant

    @aldereteka

    Will someone please help a poor frustrated soul? I’m a total beginner at all things WordPress, Buddypress and even further, CSS, PHP, etc. and I think this is an easy question, I just can’t figure it out.

    I’m trying to make my child functions.php override the parent one in Buddypress 1.6.4 Default theme, but I can’t get any of it to work and it’s driving me bananas. Using the following code in the parent functions.php, I was able to change the default “wordpress@yourwebsite.com” email address but that’s obviously not sustainable as any update with wipe it clean. How do I make it work in my child theme?

    Thanks,

    Carlos

    function res_fromemail($email) {
    $wpfrom = get_option(‘admin_email’);
    return $wpfrom;
    }
    function res_fromname($email){
    $wpfrom = get_option(‘blogname’);
    return $wpfrom;
    }
    add_filter(‘wp_mail_from’, ‘res_fromemail’);
    add_filter(‘wp_mail_from_name’, ‘res_fromname’);

Viewing 9 replies - 1 through 9 (of 9 total)
  • Avatar of aldereteka
    aldereteka
    Participant

    @aldereteka

    Oh, and I’ve already followed the step-by-step building child theme in the bp codex. It’s how I’ve wandered this far.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    Functions files are not overridden, they are both read in a parent / child relationship so your unique functions written in your child themes functions file are read  first then anything in the parent. As for losing changes why would you ? You shouldn’t lose anything in your child theme functions file it will not be wiped out with updates.

    Avatar of aldereteka
    aldereteka
    Participant

    @aldereteka

    Thanks for responding, Hugo. I changed the parent functions.php because nothing was changing in the child one. When Buddypress is updated, I understand that any changes will be lost. Sorry if that wasn’t clear. My problem is that the child theme functions is not being read at all and I don’t know what I’m doing wrong.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    is the child theme actually working period? Have you tested that it is actually working?

    Avatar of aldereteka
    aldereteka
    Participant

    @aldereteka

    It’s the theme that I’m using, but when you posed the question, I tried altering stuff through the stylesheet and nothing happened.

    Could the problem be the URI? It’s the only thing I wasn’t sure about when creating the child theme. Like I said, I’m learning as I go.
    Theme URI: http://nativelounge.org/themes/child/
    Author URI: http://nativelounge.org/

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    The important part is:

    Template:  bp-default

    Tags:  buddypress

     

    Other than that it’s hard to say based on supplied info what is wrong.

    Avatar of aldereteka
    aldereteka
    Participant

    @aldereteka

    Weeeeell, it looks like the child theme wasn’t activated. I’m sorry to have wasted your time. I was certain that I hit activate but obviously not. I’ll try out the child functions now. Thanks again.

    Avatar of aldereteka
    aldereteka
    Participant

    @aldereteka

    Works. I appreciate the time.

    Avatar of Hugo
    Hugo
    Moderator

    @hnla

    cool :)

Viewing 9 replies - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.