简体   繁体   中英

How can I find the source of a css style loaded by customize.php in my Wordpress blog?

I'm trying to alter the layout of my blog, specifically the Navigation Bar , but some pre configured css style is loaded by customize.php . Sometimes it's load-style.php , and both have an extended parameter (I know nothing about it), like customize.php?url=https...blhablahblah.

How do I find the source of these css codes?

I could make some changes by adding new codes to the style.css and style.min.css , and also to the custom css area provided by the Generate Press Theme, but it would be easier if I could delete or alter some lines from this mysterious source. (by the way, all I know of coding I learned in the past 3 days, trying to set my blog online. I had great intuitions from the Chrome developer tools).

Here's what I get from inspecting with the Chrome DevTools:

.main-navigation .main-nav ul li[class*="current-menu-"] > a {
color: #ffffff;
background-color: #ffffff;
}

That is part of a style loaded by the php files, and it's shown as one single long line in the source code inspection.

When I open the php files, I don't find these lines, so I suppose they load it from another source, and I still can't understand the php language.

I wish I could alter it, or at least delete or disable it, because this line has other style I don't want loaded.

I'd appreciate any help.

You shouldn't modify core files of WordPress because your changes may affect something else or be wiped out with each version release.

What you can do is in your style.css just at the !important to your CSS to override it.

For example:

.main-navigation .main-nav ul li[class*="current-menu-"] > a {
    color: #000 !important;
    background-color: red !important;
}

Without seeing the actual code its hard to suggest the solution. However, I guess, your theme is using inline style function wp_add_inline_style();

You can read WordPress Codex to learn more about this function. And if you able to find out the responsible function, you can use 'wp_deregister_style' to disable that.

Even if you are not able to trace those code, you can override its CSS using the same wp_add_inline_style function.

wp_add_inline_style

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM