• Hey,
    in the last time I tried to put things in the functions.php of my child theme but I think that I didn’t wrote it correctly.
    This is the complete content of my funbctions.php:

    <?php
    add_filter('tc_menu_display', 'acub_menu_display');
    function acub_menu_display($output) {
    	echo preg_replace('| class="dropdown-toggle" data-toggle="dropdown" data-target="#"(.+?)<b |', ' class="a-stripped" $1</a><a href="#" class="dropdown-toggle a-caret" data-toggle="dropdown" data-target="#"><b ', $output, -1);
    	}
    	add_filter('tc_logo_title_display', 'your_logo_display');
    function your_logo_display($output) {
    return preg_replace('/brand span3/', 'brand span10 offset1', $output, -1);
    }
    
    add_filter('tc_credits_display', 'my_custom_credits');
    function my_custom_credits(){
    $credits = 'Impressum';
    $newline_credits = '';
    return '
    ?>

    Does someone know what I did wrong so the functions.php doesn’t work?

    Thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve had the same problem. I have yet to get a function to work using a child theme functions.php file and code. It crashes the website every time. I’ve had no problems with dozens of CSS codes I’ve used from this forum and website snippets.

    Your my_custom_credits() was copy/pasted only partially. All php functions have this structure:

    title_of_function($vars) {
    // lines of code
    }

    title_of_function = name by which the function is called. Mandatory.
    $vars = any number of variables that are used when function is called to pass parameters about the context in which the function is called. Note that even when you don’t have any vars you still need to end the name of the function with round parenthesis: example_functio();
    // lines of code = hard to believe, but they are optional. Yes, you can declare a function in php that doesn’t do anything. You than call it and nothing happens. The only rule about the lines of code is that they have to be wrapped in accolades, so the parser knows when the function has ended, so he can get back to the place from where the function was called and continue parsing.

    So, your solution is to go back to the place where you got the my_custom_credits() function and copy/paste all of the code this time.

    If the function doesn’t end, the site breaks. It’s that simple.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I make a fubctions.php?’ is closed to new replies.