• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Page-Specific Stylesheet in Header

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Page-Specific Stylesheet in Header

This topic is: not resolved

Tagged: Bootstrap, css, header

  • This topic has 3 replies, 2 voices, and was last updated 11 years, 4 months ago by jfortenberry.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • October 16, 2014 at 2:54 pm #128050
    jfortenberry
    Member

    I need to be able to insert a few stylesheets (Bootstrap) into the <head> tags of of a particular page. I am able to add them to the entire site using the Header and Scripts section of the Theme Settings, but that isn't what I need. I need to be able to add them on a single page. I have created a special template for the page (if that matters).
    I looked through the hooks, and I don't see anything that allows me to inject the stylesheet references into the header file. Any suggestions on how I might insert the stylesheet references into the <head> tags on a single page? Any thoughts would be greatly appreciated.

    October 16, 2014 at 6:56 pm #128068
    jfortenberry
    Member

    Okay, I figured this out. Here's the code that I used for future reference.

    // * Add Bootstrap custom styles to form; need to add the parameter for is_page(page), replacing "page" with the slug for the page where the stylesheet should appear
    function bootstrap_custom_style_sheets() {
    if (is_page(page) ) {
    	wp_enqueue_style( 'bootstrap-custom', home_url('/form/assets/css/custom.css'));
    	wp_enqueue_style( 'bootstrap-min', home_url('/form/assets/bs/css/bootstrap.min.css'));
    	wp_enqueue_style( 'bootstrap-theme', home_url('/form/assets/bs/css/bootstrap-theme.min.css'));
    	wp_enqueue_style( 'font-awesome', home_url('/form/assets/fa/css/font-awesome.css'));
    }}
    add_action('wp_enqueue_scripts', 'bootstrap_custom_style_sheets');

    There may be a better way, but this worked for me.

    October 16, 2014 at 11:08 pm #128079
    Tom
    Participant

    You can also to do this via the "Scripts" section of each individual page. For instance , if you want to use Font Awesome icons only on one page, add this to the page's Scripts edit box:
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
    and the icon code via the page's text editor:
    <i class="fa fa-copyright"></i>


    Choose your next site design from over 350 Genesis themes.
    [ Follow me: Twitter ] [ Follow Themes: Twitter ] [ My Favourite Webhost ]

    October 17, 2014 at 9:24 am #128149
    jfortenberry
    Member

    Thank you for sharing, Tom. That looks like a better approach.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble