I create a new WordPress theme in WordPress latest version 4.5.1. and some theme css override in admin theme. How can I block this css for admin area?
Use wp_enqueue_style to add css/js to front end.
add_action('wp_enqueue_style', 'some_hook_function'):
Use admin_enqueue_scripts to add css/js to back end.
add_action('admin_enqueue_scripts', 'some_hook_function'):
Related
I want to use the page I design from scratch using HTML, CSS and JavaScript as the default homepage to WordPress.
The page is not on WordPress. I created it myself.
Make it a template file by adding this line to the first line
<?php /* Template Name: Homepage Template */ ?>
place it in your theme folder
Go to WordPress admin and create a new page, select template option to be Homepage Template, save it.
Now go to WordPress settings, Reading and select it as homepage.
Hope it helps
I know what kind of styling I want, and how to program in CSS and I have equired a BuddyBoss theme and I have asked on their forum for help but they haven't got back to me so I'm wondering if someone can help.
How would I go about changing the style of a particular link in a BuddyBoss theme?
We recommend adding all of your CSS edits into your child theme at /themes/buddyboss-child/css/custom.css. Any styles added to this stylesheet will overwrite styles set in the parent theme’s /css/ folder.
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"
type="text/css" media="screen, print" />
According to above you can add your style sheet.
Create a file buddypress.css in your css folder.
Add BuddyPress Styles to a Theme
BuddyPress 1.7 adds the ability to use any WordPress theme. The theme compatibility has a base style sheet that helps format the BuddyPress content. The styles may not be perfectly suited to your theme.
It’s very easy to add your own styles. If your theme folder has a sub folder called css you only need to add a stylesheet buddypress.css to this folder and BuddyPress will use this file overriding the BuddyPress styles. If the css folder is missing just create one and include the file inside. You can copy the buddypress.css file from the BuddyPress plugin folder and edit or create your own.
Theme Developer:
If you want to ship your theme with extra styles to support BuddyPress add the BuddyPress styles to the buddypress.css file and include it in your theme. Do not add the BuddyPress styles to your style.css file. This will ensure the styles are only loaded when BuddyPress is activated and will override the default styles supplied by the plugin.
Prefix your styles with #buddypress to target the areas of BuddyPress content.
#buddypress .activity-content {
}
*NOTE As of 1.8 you can place the file in /my-theme/community/css/ or /my-theme/buddypress/css/
check this link
https://codex.buddypress.org/themes/theme-compatibility-1-7/add-buddypress-styles-to-a-theme/
I've created child themes before without issue however when I create one using Woocommerce Mystile theme it does not display properly with menu items missing and images resizing to be too large.
I made the child theme by creating a new folder in the wp-content>themes folder called mystile-child and creating style.css with the contents
/*
Theme Name: Mystile Child
Description: Mystile Child Theme
Template: mystile
*/
I then created a functions.php file with the contents
<?php
add_action( 'wp_enqueue_scripts', 'enqueue_parent_styles' );
function enqueue_parent_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
?>
this is what the parent theme looks like:
This what the child theme looks like
Just out of curiousity - were the logo and other missing elements set up intially using the theme customizer (reached via the wordpress admin menu Appearance > Customize)?
If that's the case, then those settings are created outside of your theme and need to be reset or imported for your child theme. There are a few ways to accomplish this, the easiest way being with a plugin which imports/exports those Customizer settings.
Hope that helps,
Laura
Okay I fixed the problem following the advice found on Wordpress.org support forum here https://wordpress.org/support/topic/mystile-theme-child-header-problem
Seems more of temporary fix though and something that the people at Woocommerce should investigate.
It seems that an edited copy of shortcodes.php in child-theme of mezzanine flat theme is not working (does not override the parent theme)
I tried copying the whole lib folder where shortcodes.php is located but still not working. Is there anything I need to do to make it work? Other common pages of wordpress (i.e. header and page) override smoothly on child pages.
Thanks in advance.
You can't override shortcodes.php because the child theme replace only template files
But you can create a new file, like custom_shortcodes.php with your custom shortcode, save in your child theme and then include it in functions.php ( include 'custom_shortcodes.php'; )
I am new to wordpress. Is it compulsory to add custom css to wordpress?
Can we change in its style.css?
No it is not compulsory to create custom CSS file But it is a better practice to not use core theme CSS for plugins.
To add custom CSS in wordpress add the below cod to theme/theme-name/functions.php file :
function hook_css()
{
wp_enqueue_style( 'unique-css-name', 'your-css-path/style.css' ); // includes CSS file
}
add_action('wp_head','hook_css'); // calls hook_css in head block
Since you are new to WordPress you must know wp_head is a hook which is automatically called in head tag