Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding Two Custom Stylesheets
Tagged: Custom Stylesheet
- This topic has 6 replies, 3 voices, and was last updated 8 years, 6 months ago by Marlon.
-
AuthorPosts
-
October 12, 2015 at 6:19 pm #167977MarlonMember
Hello StudioPress,
I'm trying to add two stylesheets to Centric Pro, and was only able to add one with the following code placed in the child theme functions.php:
//*Custom Stylesheet
add_action( 'wp_enqueue_scripts', 'custom_load_custom_style_sheet' );
function custom_load_custom_style_sheet() {
wp_enqueue_style( 'custom-stylesheet', CHILD_URL . '/custom.css', array(), PARENT_THEME_VERSION );
}I have the second uploaded, but cannot figure out how to insert it in the code above or maybe i'm doing it wrong?
Can anyone provide some assistance on how to achieve adding two stylesheet?Thank you in advance
Marlon
October 12, 2015 at 7:02 pm #167983Brad DaltonParticipantOctober 13, 2015 at 10:48 am #168041MarlonMemberHello Brad,
Thank you for replying. What actually worked for me was just adding the following code, below the code I have above in the functions.php. I was actually not trying to style a page, i was just trying to add two more stylesheet (One for font Awesome). Thanks for your tutorial though, now I know how to add another stylesheet if I decide later to make individual page styling.
If anyone is interested in the code i used, it's below.
// Load Font Awesome
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css' );
}
October 13, 2015 at 11:51 am #168046itzsniderParticipantMarlon,
Why are you calling two style sheets may I ask? That just adds more time for the server to read through code etc?
Just asking is all.
October 13, 2015 at 12:27 pm #168059MarlonMemberHello Mathew,
Thank you for asking.
The reason I’m using two stylesheets? Because I wanted a pricing table that was not a plugin, would not break my site, and was able to pass W3C validation. Even though centric pro has a basic pricing table, I wanted something with more style to it. I’m still a beginner, learning to code :).I bought a pricing table from CodeCanyon that was built using pure CSS and HTML (Not a WordPress plugin). It came with two stylesheets, one for Font Awesome and the other for the pricing table. So far it’s working with WordPress without any issue, but according to your comment I might be doing something wrong here?
Do you have a better approach to kindly share? I thought about combining the stylesheets in one, but the child theme has a very long CSS file. The stylesheet I’m currently using for Font Awesome is located here: “maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css”, but for the pricing table it’s located on the server. If you can advise me on the best practice to achieve my goal, I would greatly appreciate it.
Best regards
NickeaOctober 13, 2015 at 12:33 pm #168063itzsniderParticipantMarlon,
The built in pricing table has everything you need as a basis to make better. You can add anything with the properties you want honestly. You just need to know how.
I would advise the use of the built in CSS pricing Table and the use of some fantastic CSS craziness over adding more load to the server/site.
Speed is everything now-a-days.
October 13, 2015 at 2:14 pm #168069MarlonMemberMathew,
Very interesting and funny :). I will work on "some fantastic CSS craziness", but for now I will use the pricing table and learn as much as I can then customize the built-in pricing table. I agree 100% that speed is everything, guess I was looking for a quick fix for my project.
Mathew, thank you very much for your advice. I will delve further into CSS.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.