SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Oct 2010
    Location
    Portland, Or
    Posts
    724
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    not able to connect a subtemplate to a custom css style sheet.

    Howdy all. did put this up in the wordpress.org site. But the only suggestion that came up did not work.
    Hope someone here can offer some good advice.
    This is what I have in my functions.php

    Code:
    //load subtemplate aboutus
    function aboutus_style() {
    	if( is_page_template('aboutusSub.php') ) :
    	wp_register_style('my-style', get_stylesheet_directory_uri() . '/css/aboutus.css', array(), '', 'all' );
    	wp_enqueue_style( 'my-style' );
    	endif;
    }
    add_action('wp_enqueue_scripts', 'aboutus_style');
    that code above is recognized and the subtemplate picks up the css.
    the code below. should work. but the page, w/the correct subtemplate added and selected as well in the admin create pages panel doesn't.

    Code:
    //load subtemplate level3and4
    function l3_style() {
    	if( is_page_template('l3sub.php') ) :
    	wp_register_style('my-style', get_stylesheet_directory_uri() . '/css/l3.css', array(), '', 'all' );
    	wp_enqueue_style( 'my-style' );
    	endif;
    }
    add_action('wp_enqueue_scripts', 'l3_style');
    so for example the page http://thebigmeow.us/invest/reports/
    or http://thebigmeow.us/engineering/oil-gas-and-chemicals/
    are not picking up any styling.
    is not picking up the styling assigned.
    How can I fix this please?
    thank you.
    d

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi pdxSherpa,

    It could be the handle (the first parameter in wp_register_style) you've registered the second style with. You're using my-style for both aboutus.css and l3.css. I think that the handle uniquely identifies the style so you'll probably need different values.

    See: http://codex.wordpress.org/Function_...register_style


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •