Changing link color in media/text block not resolving
-
Hi,
I am trying to change the link color in the second media/text block that shows in the page and I don’t understand why it keeps showing in blue. The inspector shows:
`:root .has-link-color a {
color: #00e;
color: var(–wp–style–color–link,#00e);cheers,
RodThe page I need help with: [log in to see the link]
-
We’re not seeing any text in blue, can you please be more specific as to exactly which text you are having trouble with?
Thanks,
Oliver
Hi Oliver,
Sorry, I had already added this CSS to patch it over..apropos_story2.has-link-color a { color: var(--wp--style--color--link,#fff);
I have just put it back so you see it.
But where does that blue come from? why is it not affected by the media-textblock color settings?
thanks,
Rod-
This reply was modified 4 years ago by
rod.
That page you linked to in your original post doesn’t have a class “apropos_story2” in it but it does have “apropos_story2-quote” (pull quote block) and “apropos_story2-poem” (group block).
Neither have “has-link-color” class and neither have an “a” tag element.
So I’m afraid I can’t answer your question, sorry!
Please provide the page where your “apropos_story2” class exists and I will inspect to see where the blue is appearing on your anchor links.
Oliver
Hi Oliver
You’re right, I changed quite a bit that page the last night. The class it’s called “apropos_story1-partie2” and here is a screen shot so you can see what I see.The link text becomes blue only when I select a link color in the color settings of the block.
thanks
RodHi Rod,
You’re using the Gutenberg plugin which is loading the …
:root .has-link-color a { color: #00e; color: var(--wp--style--color--link,#00e); }
… which is causing your issue.
I’m not really sure why you have the Gutenberg plugin but usually people only install this to test the very latest version of Gutenberg before it’s included in core?
You should probably delete that plugin unless there’s specifically some feature of it that you’re using that’s not in core!
Oliver
Oooh! Thanks for the heads up.
I was a bit desperate with my lack of ability to control the different blocks from the editor and thought that was a plugin that would make it easier for me. I realized it didn’t bring much of new but I completely forgot about it.
Glad you are there.
Thanks
RodNo problem Rod, glad that mystery is solved for you ??
I’ll mark that as “resolved” now.
Oliver
Hi Oliver, sorry for coming back on this but the link still shows in blue after I uninstalled the plugin. Any idea why would it do that?
Hi rod,
The same CSS seems to be in core Gutenberg too.
So to get around this, I would use this in “Customizer – Additional CSS” …
.YOUR_BLOCK_CLASS .has-link-color a { color: #ff0000; }
… changing it to use your own block CSS class and desired color.
Oliver
Nice, thanks again for coming to the rescue.
cheers
RodIt works in the Customiser but it doesn’t when I copy it to the Style.css in the child-theme. Any idea why that happens?
sorry for keeping you in this,
RodUPDATE: I find it weird that that link doesn’t have an underline like when I create other links for testing. I don’t have the option “Remove Link Underlines” checked neither.
-
This reply was modified 4 years ago by
rod.
Ok, found out why it didn’t apply through the child theme.
sorry for that
Rod
OK Rod, was going to say it’s probably where the child theme CSS file is being placed in the header.
We don’t use child themes (ever!) because we’ve found there’s nothing that can’t be achieved with the original theme with a bit of CSS, HTML, JavaScript and a few actions or filters ??
Oliver
OOh, glad you bring that up. I was discouraged from asking imagining how busy you are ^_^
I am a bit unsure or even divided about how to approach all this. Is it better to find a plugin for each thing that I need to add to the website that doesn’t exist already in the theme? Or is it better to reduce the code to the minimum and do it by ourselves, in order to make the website lighter?If the second option is preferable, when I add css to the customiser, or a new function to the functions.php, there is no risk of being erased by a WordPress update if I don’t use a child theme? How could I edit the footer.php structure as I did otherwise, for example, without a child-theme?
I don’t know javascript. I imagine a long learning curve if I put my effort to it.
Thanks for sharing that.
RodHi Rod,
This is a tricky one to answer I think because it depends on your perspective.
Obviously you don’t want to have to find a plugin for each modification you want to make to your website but equally we always avoid a child theme because we want our theme to be able to be updated without worrying that it will become out-of-sync / incompatible with the child theme that’s been created! If this were to happen then all the modifications made to a then incompatible file might need to be re-created from scratch in order to keep the child theme in-sync with the parent theme!
So we’ve created the “Options for …” range of plugins to try to be a one-stop-shop for all feasible modifications. If the theme is updated and something drastic were to change that would affect the plugin … we’d quickly provide an update to resolve the issue ??
Let’s also remember that the use of a child theme is not without its additional requirement of resources … after all, you are effectively then using two themes rather than one and WordPress Core then has to decide which elements of each to use which takes processing time.
So, that all being said, let’s see what can be done instead of creating a child theme …
- CSS changes – CSS can be easily injected into “Customizer – Additional CSS” which in turn is injected into the header of the site using
<style>
tag. Some would say that a separate css file is quicker / cleaner but others would say that adding another file for the site to load does the opposite. - HTML changes – HTML changes on the face of it might seem impossible without a child theme but we accomplish these with PHP hooks / filters and JavaScript. Whilst this is beyond most users, we always, as you know, take requests for new options ??
So it’s our opinion that having a couple of well supported and regularly updated plugins and some Customizer CSS is a far better solution than creating your own child theme which is then only updated when you update it.
But that’s only our opinion!
Oliver
-
This reply was modified 4 years ago by
- The topic ‘Changing link color in media/text block not resolving’ is closed to new replies.