- This topic has 36 replies, 2 voices, and was last updated 3 years, 10 months ago by Tom.
-
AuthorPosts
-
April 8, 2020 at 12:26 am #1230797Michael
Hi Tom,
Looks like I spoke too soon. I’m getting these errors:
https://www.dropbox.com/s/jhzaju7uhdvncxo/broken-theme-errors.jpg?dl=0
I’ve also added the fonts to the child theme folder and adjusted the urls, but they don’t seem to be working:
@font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; src: local("Open Sans Regular"), local("OpenSans-Regular"), url("fonts/open-sans-v17-latin-regular.woff2") format("woff2"), url("fonts/open-sans-v17-latin-regular.woff") format("woff"); font-display: swap; }
If I type https://www.reclaimdesign.org into the browser the icon fonts show as broken, and I’m not following why:
https://www.dropbox.com/s/0v4zrew3sp0y9ei/broken-ico-fonts.jpg?dl=0
Do I have to change the code snippets I’ve made previously too? Not sure if they will break with the new child theme function php file?
April 8, 2020 at 9:35 am #1231547TomLead DeveloperLead DeveloperMake sure your child theme has this “Template” line here: https://www.screencast.com/t/ViOpNZ0S
April 8, 2020 at 10:20 am #1231597MichaelThanks Tom π I had initially overwritten that when I copied and pasted (I thought it was just a comment line).
Is simple CSS redundant now that I am using a child theme? And do I need to adjust any of my code snippets at all to point to the new functions.php or will that happen automatically?
April 8, 2020 at 7:23 pm #1231994TomLead DeveloperLead DeveloperIf you’ve added your CSS to the child theme, you no longer need to use Simple CSS.
All of your code snippets can go into the
functions.php
file as well, so you can likely ditch that plugin as well. You’ll need to manually move them.April 9, 2020 at 3:25 am #1232269MichaelThanks a lot Tom π Is it possible for me to turn off the Did You Know box so it can free up some screen real estate? There’s no X button.
https://www.dropbox.com/s/emesr03iv569nq1/did-you-know-box.jpg?dl=0
April 9, 2020 at 9:39 am #1232894TomLead DeveloperLead DeveloperFor some reason, it doesn’t look like it can be removed: https://wordpress.org/support/topic/notice-at-the-top-of-the-child-theme-stylesheet/
April 9, 2020 at 11:10 am #1232995MichaelThanks for that link Tom – I gave that code they suggest a try and it seems to work OK for me (touch wood!):
add_action('admin_head', 'removeMessage'); function removeMessage() { echo <<<EOF <style> #message { display: none; } </style> EOF; }
April 9, 2020 at 11:12 am #1233000MichaelHi again Tom, can you suggest why the icon fonts break when entering https://www.reclaimdesign.org/ initially? I cannot work it out at all. I thought it was because the src urls weren’t relative, but they are now, and it still happens.
April 9, 2020 at 5:27 pm #1233346TomLead DeveloperLead DeveloperThat code you added will remove all messages from the Dashboard, which isn’t a great idea.
The font icons are broken because you’re visiting the site using
www
and the files are being served without thewww
.You’ll want to 301 redirect www to no-www (or the other way around).
April 10, 2020 at 2:19 am #1233641MichaelAh OK, I will disable that snippet in that case. I didn’t realize.
Back to that old chestnut of www to non-www… Pain in the bum with Namecheap that one.
Thanks for your help Tom π
April 10, 2020 at 8:15 am #1234093MichaelHi Tom,
I asked on the WP forum and was given this code which seems to work (for anyone else who may want to do the same):
add_action( 'admin_head', 'hide_css_notice' ); function hide_css_notice() { echo '<style>.notice-info#message { display: none; }</style>'; }
April 10, 2020 at 9:43 am #1234228TomLead DeveloperLead DeveloperThat code will still hide all notice messages in the Dashboard, which still isn’t ideal.
April 10, 2020 at 11:34 am #1234337MichaelAh damn, right then – I’ll disable it again!
April 12, 2020 at 12:44 pm #1236529MichaelHi Tom,
I managed to get the icon fonts to display now on both www and non-www versions of the site. Obviously it would be best to have a redirect in place on the server, but as Namecheap don’t allow, it will have to be this solution! Anyway, I wanted to share it in case anyone else has need of it.
I moved the font declarations out of style.css, added them to the header and amended the urls:
add_action( 'wp_head', function () { ?> <style> @font-face { font-family: "Carrois Gothic"; font-style: normal; font-weight: 400; src: local("Carrois Gothic Regular"), local("CarroisGothic-Regular"), url("/wp-content/themes/generatepress_child/fonts/carrois-gothic-v10-latin-regular.woff2") format("woff2"), url("/wp-content/themes/generatepress_child/fonts/carrois-gothic-v10-latin-regular.woff") format("woff"); font-display: swap; /* Avoid showing invisible text while custom font loads */ } @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 400; src: local("Open Sans Regular"), local("OpenSans-Regular"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-regular.woff2") format("woff2"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-regular.woff") format("woff"); font-display: swap; } @font-face { font-family: "Open Sans"; font-style: italic; font-weight: 400; src: local("Open Sans Italic"), local("OpenSans-Italic"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-italic.woff2") format("woff2"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-italic.woff") format("woff"); font-display: swap; } @font-face { font-family: "Open Sans"; font-style: normal; font-weight: 700; src: local("Open Sans Bold"), local("OpenSans-Bold"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-700.woff2") format("woff2"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-700.woff") format("woff"); font-display: swap; } @font-face { font-family: "Open Sans"; font-style: italic; font-weight: 700; src: local("Open Sans Bold Italic"), local("OpenSans-BoldItalic"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-700italic.woff2") format("woff2"), url("/wp-content/themes/generatepress_child/fonts/open-sans-v17-latin-700italic.woff") format("woff"); font-display: swap; } @font-face { font-display: block; font-family: "Ico Moon"; src: local("βΊ"), url("/wp-content/themes/generatepress_child/fonts/icomoon.eot") format("embedded-opentype"), url("/wp-content/themes/generatepress_child/fonts/icomoon.ttf") format("truetype"), url("/wp-content/themes/generatepress_child/fonts/icomoon.woff2") format("woff2"), url("/wp-content/themes/generatepress_child/fonts/icomoon.woff") format("woff"), url("/wp-content/themes/generatepress_child/fonts/icomoon.svg") format("svg"); font-style: normal; font-weight: normal; } </style> <?php } );
Hope it’s of use to somebody. Keep well π
Michael.
April 12, 2020 at 4:52 pm #1236686TomLead DeveloperLead DeveloperGlad you got it working π
-
AuthorPosts
- You must be logged in to reply to this topic.