Tagged: x
-
AuthorPosts
-
October 21, 2016 at 9:18 am #1225451
JohanschackParticipantHey guys!
I have some custom CSS and Javascript that is used for single posts. I was wondering, if its possible to make a new style sheet, that is loaded on all post sides only, instead of loading it on every single page on my site.
I have a child theme installed, could it be a possibility, to make a new style sheet example “style-post.css” and then make it load only when you open a blog post?
Best,
JohanOctober 21, 2016 at 2:22 pm #1225807
JadeModeratorHi Johan,
Please add this code in the functions.php:
add_action( 'wp_enqueue_scripts', 'load_post_css' ); function load_post_css() { if(is_single()) { wp_enqueue_style( 'my-css', get_stylesheet_directory_uri() . '/style-post.css'); } }Hope this helps.
October 24, 2016 at 10:17 am #1228445
JohanschackParticipantHi,
Do i also have to create the stylesheet first? If yes, where do i place it in my child theme?
Thanks
October 24, 2016 at 11:35 am #1228545
ThaiModeratorHi There,
Please create a stylesheet file in the root folder of child theme: x-child/style-post.css
Hope it helps 🙂
October 27, 2016 at 3:08 pm #1233709
JohanschackParticipantThanks! result was perfect.
October 27, 2016 at 3:25 pm #1233727
Prasant RaiModeratorYou are most welcome. 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1225451 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
