Back to Community

How to Add CSS Code Snippets with WPCode

54 threads Sep 10, 2025 PluginWpcode

Content

Adding custom CSS is a common task for WordPress site owners looking to tweak their site's appearance. If you're using the WPCode plugin to manage your code snippets, you might have noticed there isn't a dedicated "CSS" code type in the dropdown menu. This can lead to confusion when a snippet containing pure CSS doesn't work as expected.

This guide explains the correct way to add CSS using WPCode's existing options.

Why Your CSS Snippet Might Not Work

When you add a CSS rule like .textmarkergelb { background-color:yellow; } directly into a WPCode snippet using the "Universal" code type, it is treated as plain text. Browsers cannot interpret plain text as a styling rule, so the styles are not applied to your site.

For CSS to work, it must be wrapped in HTML <style> tags so the browser recognizes it as a style sheet.

The Solution: Use the HTML Code Type

To successfully add CSS with WPCode, follow these steps:

  1. In your WPCode snippet, set the Code Type to "HTML".
  2. Wrap your CSS code within standard HTML <style> tags within the code editor.

    Example:
    <style>
    .textmarkergelb {
    background-color: yellow;
    }
    </style>
  3. Choose an appropriate Insertion Location. For site-wide CSS, "Site Wide Header" is a common and effective choice, as it loads the styles early in the <head> section.
  4. Save and activate your snippet.

This method instructs the browser to correctly interpret the code inside the tags as CSS, allowing your styles to be applied.

Community Feedback and Future Improvements

This workaround is well-established among WPCode users. Based on community feedback in the support forums, many users have requested that the WPCode team add a dedicated "CSS" code type that automatically adds the necessary <style> tags for convenience. While this is not a current feature, it has been noted as a popular suggestion for future development.

For now, using the HTML code type is the confirmed and reliable method for adding CSS to your site with the WPCode plugin.

Related Support Threads Support