Tagged: x
-
AuthorPosts
-
August 2, 2016 at 10:20 pm #1114848
flysocalParticipantUh oh..
With my limited knowledge… I changed my functions.php to add some code.
It immediately blew up my page.Is there a way to replace my child functions.php with the previous one?
I’m unable to log into my admin page.Thanks!
August 2, 2016 at 11:10 pm #1114872
flysocalParticipantOK,
Crisis averted! Always learning…I had to go to my host and replace the file.
In the future… how do I know if a modification to a php file will result in a blown up webpage?
Thanks in advance!
August 2, 2016 at 11:14 pm #1114873
flysocalParticipantUm…. not so fast….
All of my sidebar widgets are gone! How do I find them again? They weren’t included in the functions.php that I edited so I have no idea where their info is stored.
Any help is appreciated.
August 2, 2016 at 11:28 pm #1114885
flysocalParticipantHaving a conversation with myself.
Fixed it.
For some reason they were listed in inactive widgets under the dashboard. Just had to drag them back to the sidebar.Finally… crisis averted. Hours of work to fix one quick error.
Would like to know how to avoid a php error that is fatal.
August 3, 2016 at 12:17 am #1114923
NicoModeratorHi There,
Thanks for writing in.
Happy to hear that you have already fix the error.
To avoid fatal error, you need to test your code first on your local or dev site before you put it in your live site.
Hope it helps.
Let us know how it goes.
Thanks.
August 3, 2016 at 4:15 pm #1116096
flysocalParticipantCan you explain how to test it on a local site? My website currently shows “Under Construction”… and I’ve done all my testing and creation through wp-admin. I haven’t yet taken my site live.
How do I test it locally?
Thanks,
August 3, 2016 at 5:35 pm #1116171
flysocalParticipantARRGH!
I just did it agein. Can someone tell me what I’m doing wrong? I’ll attach the functions.php file. The only thing I changed (added) was the last function called Dynamic copywrite date.
Thanks.
August 3, 2016 at 5:35 pm #1116175
flysocalParticipantThis is the text added to the functions.php for my child theme.
// Dynamic copywrite date
//
=============================================================================
function smallenvelop_copyright() {
global $wpdb;
$copyright_dates = $wpdb->get_results(”
SELECT
YEAR(min(post_date_gmt)) AS firstdate,
YEAR(max(post_date_gmt)) AS lastdate
FROM
$wpdb->posts
WHERE
post_status = ‘publish’
“);
$output = ”;
if($copyright_dates) {
$copyright = “© ” . $copyright_dates[0]->firstdate;
if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) {
$copyright .= ‘-‘ . $copyright_dates[0]->lastdate;
}
$output = $copyright;
}
return $output;
}
//
=============================================================================August 3, 2016 at 7:35 pm #1116286
JadeModeratorHi there,
Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:
– Link to your site
– WordPress Admin username / password
– FTP credentialsDon’t forget to select Set as private reply. This ensures your information is only visible to our staff.
August 3, 2016 at 10:42 pm #1116658
flysocalParticipantThis reply has been marked as private.August 3, 2016 at 10:45 pm #1116659
flysocalParticipantI’ve reset my functions.php to a non-broken version.
The text above is what I added… and what caused the theme to crash.Am I editing the functions.php wrong? I’ve edited other php files before but never had a crash like this one.
Thanks,
August 4, 2016 at 1:38 am #1116820
Rue NelModeratorHello There,
I have checked your code and found invalid format and characters that may have created the issue. Please do update it and use this instead:
// Dynamic copywrite date // ============================================================================= function smallenvelop_copyright() { global $wpdb; $copyright_dates = $wpdb->get_results(" SELECT YEAR(min(post_date_gmt)) AS firstdate, YEAR(max(post_date_gmt)) AS lastdate FROM $wpdb->posts WHERE post_status = 'publish' "); $output = ''; if($copyright_dates) { $copyright = "© " . $copyright_dates[0]->firstdate; if($copyright_dates[0]->firstdate != $copyright_dates[0]->lastdate) { $copyright .= '-' . $copyright_dates[0]->lastdate; } $output = $copyright; } return $output; } // =============================================================================Please be very careful with the quotes. It should be noted that you need to have to proper single or double quotes. Invalid characters could throw in a fatal error. In most cases, to keep track of the error, you can enable the WP_DEBUG mode? You can do this by opening
wp-config.phpand adding
define( 'WP_DEBUG' , true );just above/* That's all, stop editing! Happy blogging. */For example:define('WP_DEBUG', true); /* That's all, stop editing! Happy blogging. */When you revisit the page with the blank screen, you should have some error output describing the issue in more detail.
Hope this helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1114848 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
