Skip to:
Content
Pages
Categories
Search
Top
Bottom

functions.php in child theme?

  • @snapstart

    Participant

    I have had to make changes to the functions.php and the only way I can get them to take is to have them in the parent theme, is this normal or am I doing something wrong?

Viewing 10 replies - 1 through 10 (of 10 total)
  • @stwc

    Participant

    I have a functions.php (with one custom function for redirects) in my child theme, no issues. I guess you’re doing something wrong! ;-)

    @snapstart

    Participant

    it has to be this part that is causing the problem, any ideas how to make it work called from the child theme folder? i am afraid to do the upgrade to 1.1.2 from 1.1.1 with stuff in the parent them!

    function postimage($width,$height) {

    $scriptpath = get_bloginfo(‘template_directory’);

    $attachments = get_children(array(‘post_parent’ => get_the_ID(), ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘orderby’ => ‘menu_order’));

    if (!is_array($attachments)) {

    $image = $scriptpath.”/images/empty.gif”;

    echo ‘<img style=”border:none;margin:0;” src=”‘.$scriptpath.’/scripts/timthumb.php?src=’.$image.’&zc=1″ alt=”” />’;

    }

    else {

    $img = array_shift($attachments);

    $imagelink = wp_get_attachment_image_src($img->ID,’full’);

    $image = $imagelink[0];

    echo ‘<img src=”‘.$scriptpath.’/scripts/timthumb.php?src=’.$image.’&w=’.$width.’&h=’.$height.’&zc=1″ alt=”” />’;

    }

    }’

    @sbrajesh

    Participant

    well,to me,It seems the problem with get_bloginfo.

    As you are using child theme,put timthumb in your child theme.

    then replace this line

    $scriptpath = get_bloginfo('template_directory');

    with this

    $scriptpath = get_bloginfo('stylesheet_directory');

    or this

    $scriptpath = get_stylesheet_directory_uri();

    Both should work

    @snapstart

    Participant

    well, i still cannot get this to work! when i upload it in my child theme, it just results in a totally blank page

    here is the file if you want to take a look–

    http://successiqu.com/communityfiles/functions.php.txt

    @andrea_r

    Participant

    A totally blank page means there’s an error in your syntax somewhere.

    Find the error logs on your server. They should have a line in there saying exactly what the error was.

    @snapstart

    Participant

    but, the exact file works from within the bp parent theme, which would suggest not syntax but paths, correct?

    @anonymized-96400

    Inactive

    You can’t just duplicate functions.php. That means that you have a few functions declared twice and the sidebars registered twice. Start with an empty functions.php file in your child theme folder and only add your custom functions, leaving all the functions from the bp-sn-parent functions.php out.

    @sbrajesh

    Participant

    yeh,Travel-Junkie is right.There should be no clash between the name of functions declared in parent theme’s functions.php and child theme’s functions.php

    @takeo

    Participant

    I learned when trying to override the BuddyPress widget registrations that your theme will use BOTH function.php files… the parent and child. So you may need to unregister the original function and/or use a new function name… etc.

    @snapstart

    Participant

    thank you! that fixed it

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘functions.php in child theme?’ is closed to new replies.
Skip to toolbar