0

I did a small adjustment in the 'custom css' in my theme settings, and now I broke my theme. Whenever I select a page as the home page, it says 'Nothing found'. Whenever I visit a page thats not a home page, it works perfectly fine.

Been looking for hours now. Any help appreciated.

Edit: The change in the CSS I made was temporary putting a piece of CSS within a comment (/* foo */) for testing purposes.

3
  • 1
    If you can visit pages other than your homepage, are you not able to log in to the dashboard and remove your code? A "Custom CSS" block like many themes provide is not a direct stylesheet, it's usually code that's injected into your page. The theme you're using may not know how to correctly parse the /* markers. – tmdesigned Jan 19 '19 at 10:47
  • Well, the weird part was that after I clicked save, my whole custom CSS was gone, so that's not the problem. I've a feeling that data in the database or a theme file has gone corrupt or something. – Richard Jan 19 '19 at 10:50
  • That's not surprising to me if it didn't know how to parse it and it wasn't sanitized properly. Your code block may be inadvertently commenting out part of the theme's code that was meant to handle it, if you know what I mean. I would look in the database (if you are comfortable with it) and remove that part of your code. – tmdesigned Jan 19 '19 at 11:29
0

I agree with the comment of @the_hobbes about your code block inadvertently commenting out part of the theme's code. If removing that part of the code doesn't fix the issue, you can try reinstalling the WordPress theme. It will enable the homepage to display with the default CSS codes. Follow these steps:

  1. In the WordPress admin, head to Appearance > Themes. Activate TwentyFifteen.
  2. Click on your theme’s thumbnail. Then click the Delete link in the lower-right. Confirm delete.
  3. Head to Add New > Upload Theme. Install the zipped files of theme and activate it.

Now, you should be able to get access to your homepage.

0

Offhand, it would seem commenting out the custom CSS ought to work. But it's not surprising that it doesn't. So, yes, reinstalling to theme or modifying the database are reasonable things to try in getting the site home page to work again. It's probably not worth trying to figure precisely what's going on, unless simple recovery methods fail.
I can't resist answering the question of what do instead to experiment with a theme's CSS. At least two possibilities:
- for very momentary experiments, use Chrome's Developer Tools. (Firefox has similar tools, but I don't know that Internet Explorer or Edge do.)
- for somewhat less momentary experiments, use a child theme. In it, you can have an ordinary style.css file, in which you can comment-out parts as usual, or keep multiple versions on hand, or use git, etc.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.