• Resolved guide2gaming

    (@guide2gaming)


    I was attempting to make it so that our video and screenshot posts would also feature in our main feed. I was tweaking what it said:

    function new_excerpt_length($length) {
    global $post;
    if ($post->post_type == 'post')
    return 40;
    else if ($post->post_type == 'reviews')
    return 20;
    else
    return 40;
    }
    add_filter('excerpt_length', 'new_excerpt_length');

    And I changed it to:

    ($post->post_type == 'post', 'video')

    All of the above code editing was done in functions.php in the editor of wordpress for our Theme. I have a copy of the correct php and have it on the template download file to. Tried putting back to normal through FTP (FileZilla) and Filemanager on our hosts Dashboard, however nothing?

    Now, we have nothing. No web site or admin login. It shows an HTTP 500 error. How can I get our web site and content back up? Really stuck on this and I feel that my error has just ruined all previous work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    Try downloading the functions.php file by using FTP or whatever file management application your host provides. Open it in a text editor and revert the changes you made and load it back up to your site.

    Try it with this:

    if(in_array($post->post_type, array('post', 'video')))

    Thread Starter guide2gaming

    (@guide2gaming)

    We downloaded it using FileZilla FTP and Filemanager – through our host, in both attempts we changed the code back to original, from the copy we saved, trying to be safe. However the site does not reappear, nor does the admin?

    https://www.guide2gaming.co.uk
    https://www.guide2gaming.co.uk/wp-admin

    We will try again using your code, would you have this in addition or replacing part of the orginal code? Thanks for your reply.

    Thread Starter guide2gaming

    (@guide2gaming)

    Interestingly when trying to access the Wp Admin URL the following error message displays:

    Error establishing a database connection
    This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at 213.171.193.145. This could mean your host’s database server is down.

    ?Are you sure you have the correct username and password?
    ?Are you sure that you have typed the correct hostname?
    ?Are you sure that the database server is running?
    If you’re unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.

    Although we didn’t touch anything other than the code above.

    Moderator keesiemeijer

    (@keesiemeijer)

    if this was the original code:

    if ($post->post_type == 'post')

    try replacing it with

    if(in_array($post->post_type, array('post', 'video')))

    This function (new_excerpt_length) however changes the excerpt length and does nothing with your feeds.

    I get an “Error establishing a database connection” when visiting your site so it can be that it’s not related to you editing a functions.php file.

    Check if the database settings are correct in your wp-config.php file and contact your host to see if they have any problems on their end.

    Thread Starter guide2gaming

    (@guide2gaming)

    Thanks for your help keesiemeijer. I contacted the host after your last post. It was an unrelated error, stopping the site from loading. We had in fact fixed the coding through the FTP efforts we had made earlier in the day. The reason that the site would not load was some error with the database details, which the host fixed for us.

    We will try your code above for the action that we were trying to perform, when we have recovered from the shock, horror and stress of the site failure we have experienced today. Our reality check has also caused us to look into Vault Press signup. Thanks again.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘HELP! PLEASE!! Now got no WP Site and no WP admin’ is closed to new replies.