• 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

Right location for file to insert CSS?

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 › Design Tips and Tricks › Right location for file to insert CSS?

This topic is: not resolved

Tagged: css, navigation, Outreach Pro, wp_enqueue_style

  • This topic has 3 replies, 1 voice, and was last updated 10 years, 11 months ago by okieman.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • May 24, 2015 at 2:36 pm #153505
    okieman
    Member

    After days of testing site only installed on my PC so far, I realize the best way to customize the way my primary nav menu displays is to insert a bit of CSS. (This is Outreach Pro on Genesis.) My customer wants it to look different on all internal pages. My recent code follows, but when it loads, it somehow causes the top half of the <head> section to disappear. Yeah that breaks the page.

    In header.php (inside /themes/outreach-pro) there's this ...

    
    <?php
    // Have also tried get_stylesheet_directory_uri() in the following
    wp_register_style( 'nav-all-nonsplash-pgs', get_template_directory_uri().'/nav-all-internal-pgs.css','all');
    
    if ( ! is_front_page() ) { //* NOT viewing the home page
    	wp_enqueue_style( 'nav-all-nonsplash-pgs' );
    	}
    

    ... then in nav-all-internal-pgs.css there's this ...

    
    .nav-primary #menu-item-572 {
    	display:none;
    }
    .nav-primary #menu-item-658 {
    	display:none;
    }
    
    May 24, 2015 at 7:48 pm #153514
    okieman
    Member

    Partial progress. The css file being loaded had to go in the Genesis directory instead of the Outreach Pro directory where everything else is going on.

    The last remaining problem is getting this PHP "if" statement to tell the difference between the default first page in the site and everything else. I tried it with both || and && between the two names for such a page.

    if ( ! is_front_page () && is_home() )

    Using these two ampersands nothing at all happens on either the splash page. Using two pipes does load the style but the not (!) is somehow non-functional. The css loads everywhere including the splash where it's not needed.

    May 24, 2015 at 8:17 pm #153516
    okieman
    Member

    From the codex:

    You can only use conditional query tags after the posts_selection action hook in WordPress (the wp action hook is the first one through which you can use these conditionals). For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function.

    Not a happy camper.

    May 26, 2015 at 6:39 pm #153737
    okieman
    Member

    Two bits of news for anyone who may wander down this road:

    1- Someone has proposed a simple CSS solution that I'm now using. By adding/removing the page-id selector, and by taking advantage of the fact that CSS is processed in order, with the most recent code having priority.
    2- It's been suggested I can use a conditional tag inside functions.php via a WordPress hook. So that's my side project while the site functions happily via the CSS mod, proposed by "CrouchingBruin" ...

    .nav-primary #menu-item-572,
    .nav-primary #menu-item-658,
    .nav-primary #menu-item-747 {
       display: none;
    }
    .page-id-2 .nav-primary #menu-item-572,
    .page-id-2 .nav-primary #menu-item-658,
    .page-id-2 .nav-primary #menu-item-747 {
       display: inline-block;
    }
    .page-id-2 .nav-primary #menu-item-834 {
       display: none;
    }
  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ 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