Depending on what you want in your front home page, you might not need to make a custom page template for it at all.
Just use normal “page” and choose default (with sidebar on the side) template OR fullwidth (no sidebar) template, OR front page ( no sidebar on the side but with sidebar in the footer area).
Assign that page to be the static front page of the site.
Within this page, write your html into the post content ( switch to Text Mode for this, avoid Visual Mode ).
In your style.css target this page with .home.page or page-id-xx.
Thread Starter
Kramer
(@kramerkeller)
Yeah… I guess I am trying to do some more complex css. Not that I am amazing at css or something, but I have a good amount to add. I basically already made the seperate homepage with css on the comp… just can’t get it working online.
It seems for some reason… all the css in the default css file for TwentyTwelve is overriding everything I do. That is why I thought it might be simpler to just have a different CSS file for my homepage. Basically… all that css in style.css – doesn’t need to be loaded or apply to my home page as I am not using posts… nor do I particularly want the home page to look like a full-page template as twentytwelve has it.
Maybe I am just new to css too, but it seems that there is just so much css from style.css for my simple home page that it doesn’t work. I tried adding my css to style.css with Ids, but there is just so much css. If i do .home.page… will this override all the other CSS that is native to TwentyTwelve? Is that .home.page something that I have to add in my tags within the page / page template itself or are you referring to something inherent in WordPress? There are a lot of things set to a certain classes or IDs in WP. This was another reason I went with a template for the homepage. To remove all those IDs and classes is sort of annoying in Twenty Twelve. I have to go to the header.php file, the functions.php file… just seemed better to do a new blank template. Even then f I do just have blank template… it seems to still be calling a billion things from he style.css sheet for TwentyTwelve. When I ad my own stuff in the child-theme… it is just too much with all the TwentyTwelve stuff. So I figured it might be easier just to use a fresh css sheet since I don’t need all of that for the loaded for my homepage anyway.
Maybe there is a way to clear it out for the homepage only or as you said – maybe .home is inherent in WordPress and that will override everything?
The .home.page and .page-id-xx are classes in the <body> tag, to help you style elements in different pages easily.
http://codex.wordpress.org/Function_Reference/body_class
You can have blank css in your child theme style.css by not putting in the @import line, and make a call to different stylesheet conditionally in your functions.php.
But I don’t think that will make it easier on you, because then you will have to selectively copy over the layout from main stylesheet for your front page anyway.
it might be simpler to just have a different CSS file for my homepage
Twenty Twelve enqueues the stylesheet from within functions.php;
if you want a different stylesheet for the front page, you need to conditionally dequeue the stylesheets from within functions.php of the child theme, and enqueue the different one instead.
example code for functions.php of the child theme:
//remove general stylesheets for front page and add special stylesheet//
add_action( 'wp_enqueue_scripts', 'twentytwelvechild_scripts_styles', 20 );
function twentytwelvechild_scripts_styles() {
if( is_front_page() ) {
//dequeue existing stylesheets//
wp_dequeue_style( 'twentytwelve-style' );
wp_dequeue_style( 'twentytwelve-ie' );
//enqueue new stylesheet(s)
wp_enqueue_style( 'twentytwelvechild-frontpage', get_stylesheet_directory_uri().'/frontpage-style.css' );
}
}
Thread Starter
Kramer
(@kramerkeller)
Wow
You are awesome. This actually solved my next problem too. I was trying to basically do the same for a jquery script.
I did the following for a script in my child theme called init.js
add_action( 'wp_enqueue_scripts', 'twentytwelvechild_scripts', 20 );
function twentytwelvechild_scripts() {
wp_enqueue_script( 'init', get_stylesheet_directory_uri().'/js/init.js' );
}
Finally got it to work. Basically copied your same code above, but changed it for scripts. THANKS!
Only thing is… I guess I don’t know what the 20 means and why the add_action is above… but happy it is working.
I guess I don’t know what the 20 means and why the add_action is above…
20 is the priority; 10 is default, with 20, for example, this gets run after the the same actions from the parent theme.
adding the ‘add_action’ line above or below does not make any difference.
Thread Starter
Kramer
(@kramerkeller)
cool, well it’s all working – thanks