Tagged: x
-
AuthorPosts
-
March 12, 2017 at 11:52 pm #1404383
JfantasyBooksParticipantHi there,
Details:
Name: JFantasyBooks
Site: Fantasy-Books
Site Url: https://fantasy-books.live
WordPress Version: 4.7.1
X Version: 4.6.4
Cornerstone Plugin Version: 1.33Problem:
I want to call a css file. I just don’t know how in the x theme and where I should call it.
Can you help?
March 13, 2017 at 12:50 am #1404440
RupokMemberHi there,
Do you want to add an external CSS file? You can follow this – https://community.theme.co/forums/topic/external-style-sheet-question/#post-702014
I’d suggest to use Child Theme and use your CSS within Child Theme’s style.css.
Cheers!
March 13, 2017 at 11:19 pm #1405857
JfantasyBooksParticipantThanks.
Can you explain it a bit more?
So, in my theme folder, I made a file called css-genre and placed a css file named romance.css
function load_demandforce_style() { wp_enqueue_style( 'demandforce-style', '//fantasy-books.live/wp-content/themes/css_genre/romance.css'); } add_action( 'wp_enqueue_scripts', 'load_demandforce_style', 50This works if I don’t have that same css called in the file under customizer -> css.
I am trying to override that css file so that it would do something different under a certain condition. Problem is, this won’t override x theme’s css files.
Can you help?
March 14, 2017 at 2:40 am #1406009
RupokMemberHi there,
As it’s external CSS so it might not override the X theme’s CSS as you have set the priority (that means it will load earlier). You can try taking off the priority (50).
Thanks!
March 14, 2017 at 9:03 am #1406403
JfantasyBooksParticipantI tried that as well, unfortunately, that did not work either.
March 14, 2017 at 10:15 am #1406516
ThaiModeratorPlease try with this code:
function load_demandforce_style() { wp_enqueue_style( 'demandforce-style', '//fantasy-books.live/wp-content/themes/css_genre/romance.css'); } add_action( 'wp_enqueue_scripts', 'load_demandforce_style', 9999);Let us know how it goes!
March 14, 2017 at 10:54 am #1406612
JfantasyBooksParticipantI tried it. It didn’t work either.
Any other ideas?
March 14, 2017 at 11:35 am #1406704
ThaiModeratorHow about this code?
function load_demandforce_style() { ?> <link rel='stylesheet' id='dashicons-css' href='//fantasy-books.live/wp-content/themes/css_genre/romance.css' type='text/css' media='all' /> <?php } add_action( 'wp_head', 'load_demandforce_style', 9999);Hope it helps 🙂
March 14, 2017 at 1:46 pm #1406943
JfantasyBooksParticipantIt worked.
Only, now with this new set up, I am unsure of how to do an if, else if, and else conditions in php.
Can you show me where you’d place them?
Trying to load stylesheet for specific categories.
March 14, 2017 at 11:34 pm #1407553
RupokMemberHi there,
If you want to load for specific category then you can follow this – https://developer.wordpress.org/reference/functions/is_category/
All conditional tags could be found here – https://codex.wordpress.org/Conditional_Tags
Further customizations from here would be getting into custom development, which is outside the scope of support we can offer. If you need more in depth changes, you may wish to consult with a developer. X is quite extensible with child themes, so there are plenty of possibilities. Thanks for understanding.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1404383 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
