Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Pol Ribas Pibernat
Pol Ribas Pibernat
8,952 Points

CSS Styles in Hand-Made Plugin for Wordpress

Hi,

I have made a plugin for my website which has custom CSS Styles. I don't know why, the styles, once the plugin is activated, they look normal, as expected. But when I update the plugin's .css file, it always looks like as the 1st version of the .css file. I tried to clear cache, and it doesn't work. But when I go with Incognito Mode, it charges the most recent version of the .css file.

How can I change that?

For example, for a custom template for my theme, I do something like:

<?php function picaronia_dashboard_remove_all_styles() { if (is_page_template('dashboard.php')) { global $wp_styles; foreach ($wp_styles->registered as $item) { wp_dequeue_style($item->handle); } } } add_action('wp_print_styles', 'picaronia_dashboard_remove_all_styles');

function write_picaronia_dashboard_styles() { if (is_page_template('dashboard.php')) { $src = get_site_url() . "/wp-content/plugins/dashboard-de-picaronia/css/frontend.css"; wp_enqueue_style('picaronia-dashboard-styles', $src); wp_enqueue_style('google-fonts-picaronia-dashboard', 'https://fonts.googleapis.com/css?family=Roboto'); } } add_action('wp_print_styles', 'write_picaronia_dashboard_styles'); ?>

Thanks.