Post/Page specific custom CSS will allow you to add cascade stylesheet to specific posts/pages. It will give you special area in the post/page edit field to attach your CSS. It will also let you decide if this CSS has to be added in multi-page/post view (like archive posts) or only in a single view.
You will see additional meta box below text input area on posts and pages screen. You may add whatever CSS you want. You may choose if you want to add this CSS code on certain single page/post or on pages like archive etc.
Requirements
This plugin requires at least WordPress 5.0 (never forget to update your WP installation!) and PHP 7.0 installed on your server.
スクリーンショット
If you can't see CSS panel, check screen options and make sure "Custom CSS" is checked
Write your CSS code available only for your post or page. You may force the plugin to add CSS code only on single page view.
Added settings
インストール
Automatic installation
Automatic installation is the easiest. Simply log in to your WordPress admin panel, go to the Plugins menu and click Add New.
In the search field type Post/Page specific custom CSS and click Search Plugins. Then you can install it by simply clicking “Install Now” button.
Manual installation
Upload post-page-specific-custom-css directory to the /wp-content/plugins/ directory
Activate the plugin through the ‘Plugins’ menu in WordPress
That’s all folks, have fun 🙂
FAQ
Is it free?
Yes, it is under GPLv2 (and later) licence. However, you can donate me a few dollars if it makes you feel good. I certainly have nothing against it.
I am surprised this plugin is not more popular. It is a great way to add a little CSS to a page. Sometimes I just find it handy when I want to test CSS before adding it to my main stylesheet. Especially if I want to show someone global page changes before actually doing them globally.
Hi!
Great plugin, exactly what I was looking for.
On my version (6.1.1) the CSS validation fails due to line 679 (there is no data object in wp object).const ppsccEditPost = wp.data.select('core/edit-post');
Otherwise the CSS saves and displays correctly.
Hi there,
I really loved your plugin but after installing WP 6.0 (PHP 7.4, WPML and TOTAL theme as Template) it crashed my site.
Something caued a 500 error -> post-page-specific-custom-css.php on line 519
This is the debug information (XXXX for security reason):
[01-Jul-2022 11:48:39 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to Phylax\WPPlugin\PPCustomCSS\Plugin::the_content() must be of the type string, null given, called in /XXXXXXXXXXXXX/wordpress/wp-includes/class-wp-hook.php on line 307 and defined in /XXXXXXXXXXXXX/wordpress/wp-content/plugins/postpage-specific-custom-css/post-page-specific-custom-css.php:519
Stack trace:
#0 /XXXXXXXXXXXXX/wordpress/wp-includes/class-wp-hook.php(307): Phylax\WPPlugin\PPCustomCSS\Plugin->the_content(NULL)
#1 /XXXXXXXXXXXXX/wordpress/wp-includes/plugin.php(191): WP_Hook->apply_filters(NULL, Array)
#2 /XXXXXXXXXXXXX/wordpress/wp-includes/formatting.php(3877): apply_filters('the_content', '')
#3 /XXXXXXXXXXXXX/wordpress/wp-includes/class-wp-hook.php(307): wp_trim_excerpt('', Object(WP_Post))
#4 /XXXXXXXXXXXXX/wordpress/wp-includes/plugin.php(191): WP_Hook->apply_filters('', Array)
#5 /XXXXXXXXXXXXX/wordpress/wp-includes/post-templa in /XXXXXXXXXXXXX/wordpress/wp-content/plugins/postpage-specific-custom-css/post-page-specific-custom-css.php on line 519
Any ideas?
While it is a useful plugin, it does not wok in comments pagination. For example, you can use it to have custom CSS in a single page address: domain.com/title/ (custom css different from the general CSS of the whole site are used), but it does not work for comments pages of the same address such as:
domain.com/title/comment-page1
or
domain.com/title/comment-page2
As you know, there is no separate editing environment for comments pages. As a result, there is no separate box to add custom css for comments pages.
Suggestion for the next update: the plugin will be more useful if the custom CSS of each single page work for all of its comments pages (from first comments page to the last one).
Regards