- This topic has 11 replies, 3 voices, and was last updated 3 years, 2 months ago by
David.
-
AuthorPosts
-
February 15, 2023 at 6:34 am #2534086
Paul
Hi There,
Do you know what I could change to make hyperlinks visible within the post editor?
I can see a link style on the front end but not in the editor (see link to example post in private info)Thanks
PaulFebruary 15, 2023 at 8:10 am #2534343David
StaffCustomer SupportHi there,
if those styles are adding using CSS that is in the Customizer > Additional CSS then add this PHP Snippet to your site:
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; } );This doc explains how to add PHP:
https://docs.generatepress.com/article/adding-php/February 15, 2023 at 10:05 am #2534481Paul
Thank you David – I’ve added that PHP and I’m now seeing some of the styles in the editor but links are still unstyled there?
Cheers
PaulFebruary 15, 2023 at 11:04 am #2534551Ying
StaffCustomer SupportHi Paul,
The link style CSS is NOT added using customizer> additional CSS, it looks like being added by a plugin, the stylesheet name is
thrive-default-styles, so the code will not pull that CSS.I would recommend reaching out to the plugin’s support for this 🙂
February 15, 2023 at 12:21 pm #2534613Paul
Hi Ying,
Thanks for getting back to me.
The link style on the frontend is added via the CSS in the Customizer – see below:
/* Nice link hover effect when in paragraphs (and lists) */ #page :is(p, li) a { box-shadow: 0px -1px 0px var(--links) inset; transition: all 0.3s ease 0s; padding: 1px; } #page :is(p, li) a:hover { box-shadow: 0px -4px 0px var(--links) inset; }February 15, 2023 at 1:42 pm #2534687Ying
StaffCustomer SupportOops, sorry about that, I overlooked it, it is added via additional CSS.
If that’s the case, the style has been added to the editor.
But as you are targeting
#pagewhich doesn’t exist in the editor, so the style will not apply to the link in editor.You’ll have to remove
#pageto make it work in the editor.February 16, 2023 at 11:49 am #2535981Paul
Hi Ying,
Thank you for looking into this.
I removed#pagebut that adds the underline style to the nav elements (which doesn’t look great) is the way to hide those styles in the nav?Cheers
PaulFebruary 16, 2023 at 12:05 pm #2535994Ying
StaffCustomer SupportI would recommend writing specific CSS for the editor.
So keep the original one with
#pagefor the front end, then add this just for the editor:.editor-styles-wrapper :is(p, li) a { box-shadow: 0px -1px 0px var(--links) inset; transition: all 0.3s ease 0s; padding: 1px; } .editor-styles-wrapper :is(p, li) a:hover { box-shadow: 0px -4px 0px var(--links) inset; }February 17, 2023 at 6:27 am #2536750Paul
Hi Ying,
Thank you for helping me with this.
I added that CSS but still not seeing the styles in the Editor – sorry to be a pain!
(the links don’t need to have the same style as the front end with the transition etc they just need to look like a link so the editor can identify them)Cheers
PaulFebruary 17, 2023 at 6:46 am #2536768David
StaffCustomer SupportTry changing your CSS to this:
#page :is(p, li) a, .is-root-container :is(p, li) a { box-shadow: 0px -1px 0px var(--links) inset; transition: all 0.3s ease 0s; padding: 1px; } #page :is(p, li) a:hover, .is-root-container :is(p, li) a:hover { box-shadow: 0px -4px 0px var(--links) inset; }The second selector should also apply the styles to the
is-root-containerin the editor.February 20, 2023 at 12:48 am #2539420Paul
That’s great thank you David and Ying. Awesome support as always!
February 20, 2023 at 3:31 am #2539603David
StaffCustomer SupportGlad we could be of help!
-
AuthorPosts
- You must be logged in to reply to this topic.