How do I register/enqueue a custom CSS file?

Refer to the Codex entry for wp_enqueue_style(). Assuming you have a custom stylesheet, named custom.css, located in your Theme’s root directory: wp_enqueue_style( ‘mytheme-custom’, get_template_directory_uri() . ‘/custom.css’ ); You would put this in functions.php, inside a callback, hooked into an appropriate callback, like so: function wpse87681_enqueue_custom_stylesheets() { if ( ! is_admin() ) { wp_enqueue_style( ‘mytheme-custom’, get_template_directory_uri() … Read more

Modernizr and WordPress – How can I add a CSS class to the html element?

This is not exactly the answer, but you can use a hook for language_attributes filter. This action is fired at <html> tag and what it does is simply echo the lang=en string, for ex. You can hook to that and replace the string with your CSS class, like this: add_filter(‘language_attributes’, ‘modernizr’); function modernizr($output) { return … Read more

How to remove CSS file in the header using WordPress functions?

If your stylesheet is registered and enqueued correctly then… function dequeue_my_css() { wp_dequeue_style(‘my-css’); wp_deregister_style(‘my-css’); } add_action(‘wp_enqueue_scripts’,’dequeue_my_css’); // add a priority if you need it // add_action(‘wp_enqueue_scripts’,’dequeue_my_css’,100); … should remove it. That only works if the stylesheet was registered and/or enqueued with wp_register_style and wp_enqueue_style. If it is not registered correctly then you will have to … Read more

How to add a class to ul tags created by the WordPress editor Tinymce?

It’s always a good idea to look at WordPress Codex before asking. TinyMCE Custom Styles <?php // Insert ‘styleselect’ into the $buttons array function my_mce_buttons_2( $buttons ) { array_unshift( $buttons, ‘styleselect’ ); return $buttons; } // Use ‘mce_buttons’ for button row #1, mce_buttons_3′ for button row #3 add_filter(‘mce_buttons_2’, ‘my_mce_buttons_2’); function my_mce_before_init_insert_formats( $init_array ) { $style_formats … Read more

Remove wp_add_inline_style

Remove styles added with wp_add_inline_style() If we want to keep the custom-style-css but only remove the custom-style-inline-css, then we can try e.g. add_action( ‘wp_print_styles’, function() { // Remove previous inline style wp_styles()->add_data( ‘custom-style’, ‘after’, ” ); } ); where after is data key for the inline style corresponding to the custom-style handler. There is exists … Read more

Remove top admin bar

http://vudu.me/88 Has an article about it. But basically /* Disable the Admin Bar. */ add_filter( ‘show_admin_bar’, ‘__return_false’ ); or also //REMOVE ADMIN BAR remove_action(‘init’, ‘wp_admin_bar_init’); I believe in your functions.php will disable it. Probably a better way than just hiding it thriough css THe reason you still get the gap with the menu hidden is … Read more

How to work with custom styles saved in theme option?

When your users really need 30 lines of custom CSS, your theme is flawed. Create a set of predefined styles instead (dark and light scheme, sans and serif fonts etc.) and prepare your main stylesheet for these cases. You can hook into body_class then and add the classes you need to get these styles. Adjustments … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)