• I’m trying to use this code:

    add_filter('tc_credits_display', 'my_custom_credits', 20);
    function my_custom_credits(){ 
    $credits = '';
    $newline_credits = '';
    return '
    <div class="span6 credits">
        		    	<p> &middot; &copy; '.esc_attr( date( 'Y' ) ).' <a href="'.esc_url( home_url() ).'" title="'.esc_attr(get_bloginfo()).'" rel="bookmark">'.esc_attr(get_bloginfo()).'</a> &middot; '.($credits ? $credits : 'Designed by <a href="https://www.presscustomizr.com/">Press Customizr</a>').' &middot;'.($newline_credits ? '<br />&middot; '.$newline_credits.' &middot;' : '').'</p>		</div>';

    Any time I do, it brakes the website and I have to restore the functions.php from a backup. I am using a child theme as instructed on this page: https://presscustomizr.com/snippet/altering-adding-footer-credits/

    Why does this keep happening?

Viewing 2 replies - 1 through 2 (of 2 total)
  • In the code you cited the last and closing } is missing.
    If the curly brace (= correct word ??) is missing in your functions.php too, this might cause the problem. But I don’t know, just guessing.

    faglork

    (@faglork)

    I’d say you don’t correctly escape. You use the same escape character inside and outside.

    You start outside with a single quotation mark:
    return ‘

    you continue correctly inside with double quotation marks:
    <div class=”span6 credits”>…

    but then -still inside- you switch to single quotation marks again:
    <p> · © ‘.esc_attr…

    AFAIK this is not permitted.

    hth,
    Alex

    • This reply was modified 7 years ago by faglork.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘any edits to function.php breaks site’ is closed to new replies.