WordPress Footer.php lost all widgets

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

WordPress Footer.php lost all widgets

Post by simonmlewis »

Hi

I have just been into a WordPress admin area, using Twenty Thirteen theme.
I needed to add some basic text to footer.php, so did it in the editor.
The moment I updated, the widgets and all styling from the footer in the site, disappeared, and all we have now is the Entries RSS stuff. No styling, no footer widgets.

I did backup the file, so put back the file into the folder, but it's had no effect.

What could have happened - I literally added about four words to the file within the </a> area of "proudly powered by".
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

Ok I updated the theme, and that cleared the problem. But how do you update that text int he footer:
"Proudly powered by WordPress"

Clearly it's not by altering footer.php!!!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: WordPress Footer.php lost all widgets

Post by Celauran »

Which bit specifically are you trying to edit? #secondary? .site-info?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

within footer.php, I want to add to "proudly powered by wordpress".
I thought it would be in the Admin area, but it's in there within a .php file. But altering that screws it up.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

It's within this code I need to add some text, just after the <a> tag for Word PRess.

I daren't do it now, in case it throws a wobbly again.

Code: Select all

<?php
/**
 * The template for displaying the footer
 *
 * Contains footer content and the closing of the #main and #page div elements.
 *
 * @package WordPress
 * @subpackage Twenty_Thirteen
 * @since Twenty Thirteen 1.0
 */
?>

		</div><!-- #main -->
		<footer id="colophon" class="site-footer" role="contentinfo">
			<?php get_sidebar( 'main' ); ?>

			<div class="site-info">
				<?php do_action( 'twentythirteen_credits' ); ?>
				<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentythirteen' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentythirteen' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?></a>
			</div><!-- .site-info -->
		</footer><!-- #colophon -->
	</div><!-- #page -->

	<?php wp_footer(); ?>
</body>
</html>
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: WordPress Footer.php lost all widgets

Post by Celauran »

Can you post the changes you made or at least explain what you're trying to do? You can absolutely edit footer.php
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

Earlier on, I saw a bunch of other odd code in the footer file, but just added it like this...

Code: Select all

<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentythirteen' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentythirteen' ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?></a> &nbsp;&nbsp;|&nbsp;&nbsp;<A href='domain here'>domain here</a>
Just the "&nbsp;&nbsp;|&nbsp;&nbsp;<A href='domain here'>domain here</a>" part.

Maybe it was corrupt before but still worked. IS this the only way to edit it?
I'm fearful because I've only just taken over this web site, and I already broke it! lol
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: WordPress Footer.php lost all widgets

Post by Celauran »

I just made that exact change in a fresh WP install with 2013 theme and it's working fine.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

Maybe it was a dodgy file then. As I say, there was a TON of crap at the top of the file.
I've zipped the file and attached it. The original.

Does the content explain why when I edited it, it completely lost it??
Attachments
footer.zip
Original file
(6.33 KiB) Downloaded 157 times
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: WordPress Footer.php lost all widgets

Post by Celauran »

Without even yet having worked out exactly what that top line is doing, it looks dodgy. I'd definitely advise getting rid of that and checking through the rest of the codebase for other similar snippets. I'd guess the site was compromised at some point.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

Well the theme has been updated, and all plugins updated.
The don't know anything about this kind of thing. The chap that did it,. doesn't really want to anymore, so I "bid" to look after it. And they accepted.

10 mins later, I break it! lol. But sounds like as you say, it was dodgy.
I think the logins needs altering fast!!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: WordPress Footer.php lost all widgets

Post by simonmlewis »

It worked. No problems.
Have told them passwords needs updating, as frankly they are stupidly easy!!!!
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply