- Navigate to the ch2-private-item-text folder of the WordPress plugin directory of your development installation.
- Open the ch2-private-item-text.php file in a text editor.
- Add the following line of code after the existing functions to register a function that will be called at the beginning of the WordPress page display process:
add_action( 'wp_enqueue_scripts', 'ch2pit_queue_stylesheet' );
- Add the following code section to provide an implementation for the ch2pit_queue_stylesheet function:
function ch2pit_queue_stylesheet() {
wp_enqueue_style( 'privateshortcodestyle',
plugins_url( 'stylesheet.css', __FILE__ ) );
}
- Save and close the plugin file.
- Create a new text file in the plugin's directory called stylesheet.css and open it in a code editor.
- Add the following content to the file:
.private {
color: #6E6A6B;
}
.register {
background-color: #ff4d4d;
color: #fff;
padding-left: 10px;
}
- Save and close the text file.
- Navigate to your website, making sure you are logged in, and refresh the page containing the private text content. You should notice that the text is now displayed in gray.
- Log out of the site and refresh the page to see that the registration message styling has also changed.