• Resolved aliax

    (@aliax)


    Hi everyone! I’m new in wordpress and so far I managed to build up my website (Lionball) without modifying the code by myself (I always used plugins in order to avoid it) since I really have no idea about coding.

    However, yesterday I felt brave enough to modify the code for the first time… You can imagine I screwed-up my whole website… I basically thought that copying the following code (found here) and pasting it twice in my functions.php I could add two links in my tagline rather than only one…

    add_filter( 'tc_tagline_display' , 'my_link_in_tagline');
    
    function my_link_in_tagline() {
    	global $wp_current_filter;
    	?>
    		<?php if ( !in_array( '__navbar' , $wp_current_filter ) )  :?>
    			<div class="container outside">
    		        <h2 class="site-description">
    		        	<?php bloginfo( 'description' ); ?>
    		        	<a href="[PUT YOUR URL HERE]" title="[A TITLE]">My link</a>
    		        </h2>
    
    		    </div>
    		<?php else : //when hooked on __navbar ?>
    			<h2 class="span7 inside site-description">
    	            <?php bloginfo( 'description' ); ?>
    	            <a href="[PUT YOUR URL HERE]" title="[A TITLE]">My link</a>
    	        </h2>
    
    		<?php endif; ?>
    	<?php
    }

    That ended up terribly bad and now the following error appears everywhere, my website doesn’t work at all and I cannot even access to my dashboard:

    Fatal error: Cannot redeclare my_link_in_tagline() (previously declared in /home/lionball/public_html/wp-content/themes/customizr/functions.php:63) in /home/lionball/public_html/wp-content/themes/customizr/functions.php on line 104

    Any ideas how can I undo that or at least delete that second copy of the code that I added? I’m really sorry for asking this, but I just found myself in this big mess and don’t know how to fix it…

    Thank you very much for reading!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hey there,

    Just download the theme and replace your modified functions.php with theme’s original functions.php. Hope it helps!

    Thread Starter aliax

    (@aliax)

    Hi Suyogya Sheila,

    Thank you very much for your help! Although I finally contacted the company that hosts my website and they fixed the problem, I’m very interested in knowing your solution as a ‘just in case’ for the future. If something like that happened again, how would I change my theme? It didn’t let me have access at all to my dashboard, so I really don’t know where I should install the new theme’s functions.php to replace the old one.

    Hey there,

    You wouldn’t need dashboard access. You can just download the original theme and copy it’s functions.php somewhere. Next, you will need to login using your hosts’ FTP and navigate to /wp-content/themes/theme-name/ and delete the modified functions.php Now just upload the functions.php you earlier copied from original theme. Hope that makes sense.

    P.s – It’s shukla 🙂

    Thread Starter aliax

    (@aliax)

    I’m sorry about your user name!!! My spellchecker changed it by itself and I didn’t realised at all! >.<

    On the other hand, thank you very much for your help ^o^ I’ll keep your information for the future! 😀

    Hey there,

    It’s alright! Cheers 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Fatal error – functions.php’ is closed to new replies.