Magento css from custom skin by addCss - css

I want to load css file only for products in specific category. For that I'm adding
<reference name="head">
<action method="addCss"><link>custom.css</link></action>
</reference>
on the custom design tab on specific category in admin panel. That gives me
<link rel="stylesheet" type="text/css" href="http://domain.com/skin/frontend/base/default/custom.css" media="all" />
in the page source code.
The problem is, that this provide link from "base" skin, and I need to add it from "myCustom" skin.
<link rel="stylesheet" type="text/css" href="http://domain.com/skin/frontend/myCustom/default/custom.css" media="all" />
Any ideas how to do this using addCss or any other action that I can provide in admin panel/config file?

I think you have not set the value of "Skin (Images / CSS)" from admin. go to System->Configuration->GENERAL/Design->Themes->Skin (Images / CSS) and add your custom theme name.
Hope will help!

Your xml code is OK.
File must exists in /skin/yourpackage/yourtheme/ to be loaded (Not in /skin/yourpackage/yourtheme/css/ )

Related

Changing filenames for Bootstrap 4.5 examples

Looking to use one of the examples for Bootstrap 4.5, but whenever I change the filename of the html file or the css file for the example, it breaks the formatting link for the example page. How can I duplicate the original example files and alter the names (to something like "my_page.html" or "my_page.css" for example) without changing the page itself?
If you change the name of your stylesheet (CSS), you also have to update it in your HTML, otherwise it will point your stylesheet to the old name and will break. This works the same for all other file resources you are linking to a HTML page, such as other HTML pages, images, scripts etc.
UPDATE WITH AN EXAMPLE:
Lets say I have three files: index.html, contact.html and stylesheet.css. In my index.html and contact.html pages, they might have the following code:
<!-- index.html -->
<link rel="stylesheet" type="text/css" href="stylesheet.css">
Contact me
<!-- contact.html -->
<link rel="stylesheet" type="text/css" href="stylesheet.css">
Home
Both pages have a link to the stylesheet, and each page has a link to the other page.
Now, I want to change the name of my stylesheet to awesome-style.css, and my contact page to awesome-contact.html. I would have to make the following changes to my HTML pages:
<!-- index.html -->
<link rel="stylesheet" type="text/css" href="awesome-style.css">
Contact me
<!-- awesome-contact.html -->
<link rel="stylesheet" type="text/css" href="awesome-style.css">
Home
I have changed three lines of code here. The stylesheet has to be changed in all HTML pages for your styling to still apply to all pages. In my index.html page, I have changed the link from contact.html to awesome.contact.html so it will still link to the correct HTML page.
I have never had to change any code in awesome-style.css, as you never tell it what HTML documents you will be using it in.

preload link - wordpress and flatsome

I found so many different articles and tried to implement it, but I still can't get it working.
Google pagespeed recommends to preload few files, but I can't figure it out :/
I went ahead and updated my header.php
<head>
<!--custom preload -->
<link rel="preload" as="font" crossorigin="anonymous" href="https://allurehemp.com/allurehemp/assets/css/icons/fl-icons.woff2" >
<link rel="preload" as="style" crossorigin="anonymous" href="https://allurehemp.com/allurehemp/assets/css/fl-icons.css" >
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php wp_head(); ?>
</head>
And now i'm facing the following issue(s);
A preload for 'https://allurehemp.com/allurehemp/assets/css/fl-icons.css' is found, but is not used because the request credentials mode does not match. Consider taking a look at crossorigin attribute.
Any recommendation is appreciated =)
I realize this is quite delayed, but I just figured this out for my site. Maybe it will be helpful for others, if the OP doesn't need this anymore.
It's way simpler than I thought it would be. Below is what I did, and it worked. No more warning/penalty in PageSpeed Insights, and my performance score increased.
In your WP admin area/dashboard, go to Flatsome > Advanced > Global Settings (see screenshot below)
Screenshot of relevant Flatsome > Advanced > Global Settings area
Insert the following line into the 'Header Scripts' area:
<link rel='preload' href='//wp-content/themes/flatsome/assets/css/icons/fl-icons.woff2' as='font' type='font/woff2' crossorigin='anonymous'>
OTHER NOTES:
A. The link in my code snippet is relative to the site domain, so you don't need to change it and insert your domain or anything. The double slash forces the same security protocol as the origin site, so it should force load https if your site uses https (which it should).
B. This probably goes without saying, but you never know: If you're adding anything to the theme files, always use a child theme so your updates/changes don't get overwritten when you update your theme. Here's a great plugin I've used several times to create a child theme in WordPress: https://wordpress.org/plugins/child-theme-configurator/
C. The links you included in the in the header.php file didn't include the "type=" bit. I'm not certain, but this could have been the source of the problem for you.
D. I didn't add a preload link for the css file like you did because all my css is minified and combined. Also, that particular file is just a few lines anyway, so preloading likely won't make much of a difference.
Hopefully this helps! :)

Duplicate style.css in wordpress

I have a link to a style.css with version, which is updating each time after changing the file in my theme on server:
<link rel="stylesheet" type="text/css" media="all" href="http://example.com/wp-content/themes/twentythirteen/style.css?v=1477025590" />
Also, I can see another link to the same style.css in the source of code but with an old version which doesn't change automatically (it's a standart link of a theme):
<link rel='stylesheet' id='twentythirteen-style-css' href='example.com/wp-content/themes/twentythirteen/style.css?ver=2013-07-18' type='text/css' media='all' />
Is it normal? User should load a file twice or I can delete the second link somehow via functions.php?
Yes you need to check in your functions.php is there this css load
twice ? you can find wp_enque_style function over there.
Remove the css from there which loads twice it will solve your error

Unable to change theme in primeui

I use primeui library in my app and want to change the default theme. I followed this link and made my link tag looking like this:
<link type="text/css" rel="stylesheet" href="primeui/production/primeui-1.1-min.scc?
ln=primefaces-glass-x" />
But it has no effect.

How to change value stylesheet_url in wordpress?

I'm trying to modify a theme in wordpress and one thing I've stumbled upon is the way this theme is including a stylesheet file.
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
As I discovered stylesheet_url refers to the file named style.css in the root folder. How can I change the value of the stylesheet_url so that my stylesheet file in the css/ directory will be loaded instead of the default one?
you can put new css file path like this:
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('template_directory'); ?>/css/newstyle.css" />
and you can remove default css path if you don't need.
hope this helps you. All the best ;)
In function blog_info().
Here is the link to do this and also check this link and this.
You can also see an example here: Where is the value for Wordpress bloginfo('stylesheet_url') saved.

Resources