Get rid of demo css

Posted in: Newspaper
Post count: 151

I noticed that after importing a demo, its CSS is still loaded there.
I was wondering wheres the right place to remove this call, from the child theme, since I need to minimize requests and we already loading a dynamic css file there, in which we can integrate the css code from the demo.

Post count: 22421

Hello,

Sorry but once a demo is loaded the entire demo-style.css file corresponding to that demo will be loaded. If you remove the loading of this file, he demo will no longer receive the specific style. If you do not need to load css, you can simply use the cloud library and import the demo homepage and not use a demo at all on your install.
if you still want to remove the loading of the demo file, you cannot do it from the child theme. you have to modify the main theme files: https://www.screencast.com/t/Z6iibXLf

Thanks

Post count: 151

I see. Touching core files is not an option for us (update-wise).
So I was wondering how to recover this situation now. Can I now create a template (cloud one), import it directly and clear the loading somehow?

I mean, I can also copy the demo’s css to dynamic part, but my problem there is the loading call of the file, not the code itself.

Post count: 35449

Hi,

Yes you can use a tagDiv Cloud Template , and make sure that you do not have any demo install, in this way no demo css will be load ( the demo css is loading only if you have some demo install, if you uninstall it the css will be remove ).

Thank you for your understanding.

Post count: 151

So, next steps >
1) Importing a Cloud Template
2) Deleting demo data (how to do so?)

Post count: 35449

Hi,

You need to uninstall the demo, in this way all data/settings of that demo will be remove, if there will be some posts/pages left, you’ll need to delete them manually.

Also maybe you are interested to a Function Reference/wp dequeue style
-> https://codex.wordpress.org/Function_Reference/wp_dequeue_style
-> https://wordpress.stackexchange.com/questions/189985/how-to-properly-dequeue-scripts-and-styles-in-child-theme

Thank you.

Post count: 151

That should work better.
Let me know about the following:

Dequeing the stylesheet will work this way: style is loaded -> functions is loaded -> filter of deque is called -> style is unloaded

Or this way:
deque filter will not load style at all?

?

Post count: 35449

Hi,

It’s suppose to do not load style at all.

Thank you.

Post count: 151

Can you paste a specific example?

function wp_67472455() {
wp_dequeue_style( 'demo_style' );
}
add_action( 'wp_print_styles', 'wp_67472455', 100 );

That one didnt work.

Post count: 20685

Hi,

So you want to remove the demo stylesheet? Kind of unusual. Why would you want to do that exactly? Some demos contain a custom stylesheet with design for various elements which is not possible to do by other means. Removing the stylesheet will remove the custom design.

However if that is what you want to do, use a code like this in either main theme or child theme functions file

function dequeue_demo_style() {
wp_dequeue_style( 'td-theme-demo-style' );
wp_deregister_style( 'td-theme-demo-style' );
}
add_action( 'wp_print_styles', 'dequeue_demo_style', 1002 );

The demo stylesheet should not be loaded anymore after you enter the code.

Thanks

Post count: 151

You already loading a dynamic .css file.
Why you are not importing demo’s contents in it?

Since I have a dynamic css file there, im looking forward to minimize css requests by one, grouping their code and not-loading the second one.

Viewing 11 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic.