-
andytlaird
I have tried to create a ‘global style’ and copy from ‘legacy global styles’ but ti simply doesn’t work I the tried to create a new global style end edit it which looks fine on the back end (admin panel) but the styling doesn’t all show on the front end: text The button should have a green background with white text and on hover a black background with white text however the text is blue! I may be wrong but it could be taking that color from the ‘customize colours’
-
David
Hi there,
did you resolve the issue ? As I cannot see the problem on the site.
-
andytlaird
Hi David
The only way I got this to work was to delete the ‘Legacy Global Styles’ and make a new ‘global styles’ It was a little more work going through the website but it got the job done. My question is this: we can create a button in the ‘Customiser’ as well as ‘global styles’ Are there any advantages by doing this either way especially if I’m only going to style one button. It appears the colors made in the customizer are causing conflicts!
-
Both options use CSS, which style to show depends on which CSS has the higher priority.
The customizer button style adds CSS to
<button>
element.GB’s global style creates CSS targeting the assigned CSS class.
GB’s local block style creates CSS targeting the specific ID of the block.
If you only need one button style, you can either use GB’s global style or the customizer, however, the customizer doesn’t have a border option or a spacing option.
-
andytlaird
Thank you so much Ying for clearing this up
-
No Problem 🙂
-
andytlaird
Hi
I’m still struggling. I would like to underline links in the content only (blog posts) and make them blue. If I try to use the customizer it will affect the buttons. Could I possibly add css and would you be able to provide it?
-
Hi there,
try:
#page :is(p, li) a { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset: 4px; text-decoration-color: #0000ff; }
It will target only links in the content that are inside a Paragraph or a List item.
I added the extra style proeprties for line thickness , offset and color.Let us know
-
andytlaird
Hi David
Sorry this isn’t working
-
what’s not working?
Can you link us to the page in question?
-
andytlaird
Hi Ying
Here’s a page with plenty of links: https://andytlaird.com/entrepreneur/entrepreneurial-mindset/
-
Alvind
Hi there,
Where did you add the CSS? I’ve tested it, and it should work.
https://cln.sh/ZPY8nlxW -
andytlaird
Hi Alvin
I copied/pasted the code in “Additional CSS” and agree it should work – but doesn’t
-
Alvind
Usually, this issue is caused by syntax errors in the existing code within the Additional CSS section. To check for any errors, you can copy all the CSS currently placed there and use this CSS validation tool to confirm if there are any issues:
https://jigsaw.w3.org/css-validator/#validate_by_inputLet me know.
-
andytlaird
Hi Alvind
This was the error showing:
Parse Error add_filter( ‘block_editor_settings_all’, function( $editor_settings ) { $css = wp_get_custom_css_post()->post_content; $editor_settings[‘styles’][] = array( ‘css’ => $css ); return $editor_settings; }
-
andytlaird
I removed this and the css works:
add_filter( ‘block_editor_settings_all’, function( $editor_settings ) {
$css = wp_get_custom_css_post()->post_content;
$editor_settings[‘styles’][] = array( ‘css’ => $css );return $editor_settings;
}Was this the right thing to do? I don’t remember what this was or why I used it. Lastly would you have the css to change the link color to blue (not the underline)?
- You must be logged in to reply to this topic.