Skip to:
Content
Pages
Categories
Search
Top
Bottom

functions.php in child theme?


  • Catherine
    Participant

    @snapstart

    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

    @stwc

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


    Catherine
    Participant

    @snapstart

    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=”” />’;

    }

    }’


    Brajesh Singh
    Participant

    @sbrajesh

    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


    Catherine
    Participant

    @snapstart

    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

    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.


    Catherine
    Participant

    @snapstart

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


    Boris
    Participant

    @travel-junkie

    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.


    Brajesh Singh
    Participant

    @sbrajesh

    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

    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.


    Catherine
    Participant

    @snapstart

    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