Support » Themes and Templates » [Resolved] functions.php on childtheme : can't acces to admin panel

[Resolved] functions.php on childtheme : can't acces to admin panel

  • Hi everybody.

    I’m using this fantastic Custumizr Theme for somes websites, using childtheme, but i now meet an issue with adding a functions.php on my childtheme.

    When adding funtions.php, website is ok and functions works fine, but i can’t acces to the admin panel.

    My website : http://hebergement-responsable.fr/biomod/

    The code of functions.php is :

    /* Remove the ... from excerpt to change to readmore*/
        if( ! function_exists('name_of_function') ) {
    	function change_excerpt_more()
          function new_excerpt_more($more)
            // Use .read-more to style the link
              return '<span class="continue-reading"> <a href="' . get_permalink() . '">... >> Lire la suite</a></span>';
          add_filter('excerpt_more', 'new_excerpt_more');
        add_action('after_setup_theme', 'change_excerpt_more');
    /** reduce excerpt to 25 words */
    if( ! function_exists('name_of_function') ) { 
    function new_excerpt_length($length) {
     return 25;
    add_filter('excerpt_length', 'new_excerpt_length');

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I’m not an expert on php and i’m sure it’s just a little code tips i don’t have.

    Could someone please help me ? (sorry for bad english ;-))

Viewing 11 replies - 1 through 11 (of 11 total)
  • Mmm works fine here.
    By the way, technically but unrelated to the issue you’re experiencing, you have to replace ('name_of_function') with the actual function name, to make that check have a sense, so

    if( ! function_exists('change_excerpt_more') ) {
    	function change_excerpt_more()


    if( ! function_exists('new_excerpt_length') ) { 
    function new_excerpt_length($length) {

    Thank’s for your answer.
    Website works fine because i delete functions.php in the chidtheme.
    I changed code with your advices, but still got an issue. Website works fine but can’t acces to admin panel an white page with :

    Warning: Cannot modify header information - headers already sent by (output started at /home/heber619/public_html/biomod/wp-content/themes/Biomod/functions.php:1) in /home/heber619/public_html/biomod/wp-admin/post.php on line 235
    Warning: Cannot modify header information - headers already sent by (output started at /home/heber619/public_html/biomod/wp-content/themes/Biomod/functions.php:1) in /home/heber619/public_html/biomod/wp-includes/pluggable.php on line 1121

    An idea of where does the issue comes from ?

    Moderator stephencottontail


    In your child theme’s functions.php, make sure the starting <?php block is the very first thing in the file. There can be no blank lines or spaces before that.

    And this happens just when you have that code in your child-theme functions.php?
    Mmm, please paste the whole content of your child-theme functions.php using this and copy here the pastebin link.

    Yes it just appear when i use a functions.php on childtheme, perfecly working else.
    Thanks for your help


    @stephen : wou’re wright but still doesn’t works

    Mathu I’m sorry, I cannot reproduce your issue :/
    I thought about the same thing Stephen suggested..
    Does this happen with whatever code you put there?

    already read this?

    Remove the


    from the end of your code snippet. This might be the cause.

    @ Acub : WEAAAAAAAAHHHHHHHHHH !!!!! Thanks a lot it works perfectly !

    @d4z_cOnf : Thanks a lot for your help too !

    It’s just the first time i ask some help in the forum, and you make me save a website project !

    Un Grand Merci (in french) for your help !

    This is weird, never had problems with ending ?>. It could depend on the php.ini settings I guess..
    Glad you solved and thanks to acub 🙂

    It is generally advisable and considered good coding practice not to exit php mode before end of file of “pure” php files (that are to be included in other php files). The reason for this is quite obvious, to avoid errors like the one above: sending empty headers that can cause a WSOD.

    Namely, the problem in Math’s functions.php was that he had an empty line, space or tab after ?>.

    Yes I know, what I meant (but I expressed it very badly :)), is that I have not hat that kind of problem with ?> + spaces after, hence my guess about php.ini. Though I had an issue with the feed validator in that case.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Resolved] functions.php on childtheme : can't acces to admin panel’ is closed to new replies.