I'd like to keep the Guten styles, what do I do to only remove classic editor tinymce styles?
Using function
wp_deregister_style('wp-reset-editor-styles');
to disable default WP css on TinyMCE to style it with a skin, but it's also destroying Guten builder.
To remove your editor style, simply find where it's enqueued in your theme (probably using add_editor_style) and then you can add it back in for the block editor, using the action below.
add_action( 'enqueue_block_editor_assets', 'my_enqueue_block_editor_assets', 102);
function my_enqueue_block_editor_assets () {
wp_register_style( 'wp-reset-editor-styles', get_stylesheet_directory_uri() . '/stylesheets/my-custom-stylesheet.css', false, '1.0', 'all' );
}
Related
I am creating a theme with bootstrap for my WordPress site. I used codestar framework to make an admin panel. I want to use bootstrap icons instead of fontawesome icons used in Codestar framework. On the document page there is an explanation:
As you know, the Icon field works only in backend and you should to
include the icon CSS file in front-end by yourself. For eg. take a
look below enqueue styles example or use your own enqueue styles
method.
Here are the codes I need to change
if( ! function_exists( 'your_prefix_enqueue_fa5' ) ) {
function your_prefix_enqueue_fa5() {
wp_enqueue_style( 'fa5', 'https://use.fontawesome.com/releases/v5.13.0/css/all.css', array(), '5.13.0', 'all' );
wp_enqueue_style( 'fa5-v4-shims', 'https://use.fontawesome.com/releases/v5.13.0/css/v4-shims.css', array(), '5.13.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'your_prefix_enqueue_fa5' );
}
If still you want to use Font Awesome 4 only add this filter anywhere.
add_filter( 'csf_fa4', '__return_true' );
Bootstrap icon cdn =>
https://cdn.jsdelivr.net/npm/bootstrap-icons#1.8.1/font/bootstrap-icons.css
The problem is: How can I import the bootstrap icons into the code given above? Thank you in advance for your help.
I used translation for the question. If I'm not successful source:
http://codestarframework.com/documentation/#/fields?id=icon
I have this styles created in dynamic page with pure html, css, some js libraries. I want to add it to wordpress theme, If there any plugins can create those styles, or how can i add the code by myself ?
Style1
Style2
To add your own styles:
1) Create a child-theme
2) Add your styles to the child theme
3) Setup the child theme lo load the parent's styles.
4) If you use different css files for the added styles, load them after the child-theme's style.css is loaded.
5) For the js files you will do the same as for css files.
To load child-themes you will need make changes to the functions.php of the child-them in order to hook into wp_enqueue_scripts action.
add_action( 'wp_enqueue_scripts', 'load_aditional_styles' );
and use wp_enqueue_style();
function oad_aditional_styles(){
wp_enqueue_style( 'my_style_1', get_stylesheet_directory_uri() . '/Style1.css', array(), all );
wp_enqueue_style( 'my_style_2', get_stylesheet_directory_uri() . '/Style2.css', array(), all );
wp_enqueue_script( 'my-js', get_stylesheet_directory_uri() . 'MuJsFile.js', array(),null, true );
}
(This assumes Style1.css and Style2.css are in the root of the child-theme, otherwise you need to add the corresponding folders to the file name)
For js files, the empty array indicates no dependancies, but if you have dependancies like jQuery, the jquery handle has to be added there.
I have added this line on my plugin
wp_enqueue_style( 'dazzling-bootstrap', get_template_directory_uri() . '/inc/css/bootstrap.min.css' );
and it seems that the whole admin backend was affected of that bootstrap. Any ideas on how to be only on that plugin?
That's because you're not specifying anywhere that the file should be included only for your plugin page, and not for the whole admin backend. Try to add a conditional check and then enqueue the stylesheet.
global $post;
if ( 'enter_plugin_page_slug_here' == $post->name ) {
// enqueue stylesheet here
}
How can I add title attribute for my own custom stylesheet in wordpress within functions.php file? I find something like that
`
global $wp_styles;
$wp_styles->add('example-alt', '/themes/example/example-alt.css');
$wp_styles->add_data('example-alt', 'title', 'Example Alternate Stylesheet');
$wp_styles->add_data('example-alt', 'alt', TRUE);
$wp_styles->enqueue(array('example-alt'));
`
but I don't know how can i use it within functions.php file or anywhere else?
I'm not sure if I have understood your question. You want to add a CSS Stylesheet to your blog or an attribute to the title?
If you want to add a CSS Stylesheet within functions.php, you have to enqueue it like this:
If your CSS stylesheet is named "my-style.css", place it on a folderl called "css" withing the folder of your theme, and then write that on functions.php:
function your_theme_name_scripts() {
// For Styles:
wp_enqueue_style( 'my-style', get_template_directory_uri(), '/css/my-style.css' );
// For Scripts:
wp_enqueue_script( 'my-script', get_template_directory_uri(), '/js/my-script.js' );
}
add_action( 'wp_enqueue_scripts', 'your_theme_name_scripts' );
Your find more info about enqueueing styles here: http://codex.wordpress.org/Function_Reference/wp_enqueue_script
If you want to add any attribute to the title, you have two options: creating a filter on functions.php, or directly modifying the wp_title() function on header.php. The second options is the best one.
You find more info about the title here: http://codex.wordpress.org/Function_Reference/wp_title
I have a very simple page template, simple-template.php for which I don't use the_content(). How to I remove that textarea in the backend?
Ok so let's do this:
Add a theme option css file for the admin area. Add this to your functions.php file or in a sub functions file:
add_action('admin_enqueue_scripts', 'my_admin_scripts');
function my_admin_scripts() {
wp_enqueue_style( 'theme-options', get_template_directory_uri() . '/your-theme-css-folder/theme-options.css' );
}
Then create your theme-options.css file and place it in your theme css folder and add this:
.edit-form-section{
display:none;
}
This will hide textarea in the backend.