0

I was attempting to mimic the shortcode for a previously created button so that I could change the text and url destination.

I copied and pasted the code within the php file while utilizing the editor within the admin panel. I then changed the name of the button to try to create the new one. When I hit the save button, it gave me a load error, and now all pages are giving me the same HTTP Error 500.

This also means that I can't login to the admin portion for the website to try to correct the code that way.

I assume they are related to me changing the php file, but can't be totally certain there isn't another error. I did manage to keep part of the code I was using. The top portion is what was originally there, and the bottom is what I changed and added. I do have access through my host to all of the files, so I'm guess I need to go in that way to make any necessary changes. Any help on doing this would be greatly appreciated it.

/**
* callout buttons under page content
* Example: [callout_buttons]
*/ 
add_shortcode( 'callout_buttons', 'p14_callout_buttons' );
function p14_callout_buttons() {
$out = '';
$out .= '<div class="clearfix callouts">';
$out .= '<a class="button dark-blue" href="' . site_url( '/about/' ) . 
'">About</a>';
$out .= '<a class="button light-blue" href="' . site_url( '/our-mission/' ) 
. '">Our Mission</a>';
$out .= '<a class="button light-green last" href="' . site_url( '/store-
locator/' ) . '">Store Locator</a>';
$out .= "</div>\n";

return $out;
}

That was already there, and this is what I added as a different section.

/**
* callout buttons under page content
* Example: [callout_buttons]
*/ 
add_shortcode( 'learn_more', 'p14_callout_buttons' );
function p14_callout_buttons() {
$out = '';
$out .= '<div class="clearfix callouts">';
$out .= '<a class="button dark-blue" href="' . site_url( '/about/' ) . 
'">About</a>';
$out .= '<a class="button light-blue" href="' . site_url( '/our-mission/' ) 
. '">Our Mission</a>';
$out .= '<a class="button light-green last" href="' . site_url( '/store-
locator/' ) . '">Store Locator</a>';
$out .= "</div>\n";

return $out;
}
  • 1
    HTTP 500 is just Apache/Nginx saying something went wrong in PHP, go check what the error was, you're going to have to do the debugging process to figure out what the error was, check the error logs, turn on WP_DEBUG, etc etc then you'll know what the actual error is – Tom J Nowell Jul 6 '17 at 21:39
  • 1
    but it's probably because you have 2 functions with the same name, how is PHP to know which function you mean? Did you mean p14_callout_buttons or p14_callout_buttons? Function names etc have to be unique – Tom J Nowell Jul 6 '17 at 21:41
  • Thanks for the feedback. The issue is definitely the naming of the two shortcodes. The issue now is that I don't know how to fix it. I was editing within the wordpress admin panel (now realizing this was probably a mistake), and I can't find that particular file through my cpanel and file manager. Where within the wordpress files on my file manager can I typically find the shortcodes.php file that I edited through wordpress? – user3490954 Jul 7 '17 at 13:50
  • After debugging, I was able to find the main issue, and fix it. The website is now live again. Thanks for your help. – user3490954 Jul 7 '17 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.