Community Forums › Forums › Archived Forums › General Discussion › How to make a page style template
- This topic has 8 replies, 2 voices, and was last updated 10 years ago by garylou.
-
AuthorPosts
-
March 21, 2014 at 7:14 am #95939garylouMember
Hi everyone, I hope everyone is doing well on this Friday.
http://jeff.cobalt-emerald.com
I have a question about making style templates for different pages in Genesis.
I have done some research and I don't know now if I am wording it wrong, but this is what I am looking to do.
I basically have four styles that I would like to be able to choose from in the page attributes section of the pages.
I have my css style sheets all coded already, so would the best way to do this is to make a php file for each style, and hook those pages directly to that particular style sheet? If yes, how do I hook?
Is there another way I should thinking?
Any help is greatly appreciated.
thank you
gMarch 23, 2014 at 1:41 pm #96230Brad DaltonParticipantYes.
Simply make 4 new files named something like page_green.php and so on then use code like this in each file with a different Template Name and custom body class name and function.
Note: The function name for each template will need to be unique for each template.
add_filter( 'body_class', 'another_custom_body_class' ); function another_custom_body_class( $classes ) {
March 23, 2014 at 3:26 pm #96258garylouMemberThank you so much Brad!
Okay, I want to thank you, but I have another question then, since I am still trying to understand and learn php,
the body_class (in red), would i need to change that to what I name my page? or is that just coding to call the page?The orange colored $classes, is that where I would put what I named my page?
I am sorry for sounding ignorant, I just do not get some of the coding. I am decent in HTML and CSS, but php I am still trying to comprehend.
thank you
garyMarch 23, 2014 at 4:15 pm #96269Brad DaltonParticipantName it anything you like as its generating a new class specifically for that page template and then use it in your style sheet like
add_filter( 'body_class', 'your_custom_body_class' ); function your custom_body_class( $classes ) { $classes[] = 'gary-lou'; return $classes; }
Styles
.gary-lou { background-color: red; color: white; }
Rinse and repeat for the next template and use a unique class.
Name your page template file anything you like
Example: page_gary.php
March 23, 2014 at 4:32 pm #96271garylouMemberokay, can i use the site container and inner site classes in the new?
March 23, 2014 at 5:49 pm #96276Brad DaltonParticipantTake a look at these and you can pretty much do anything you like http://my.studiopress.com/snippets/
What do you want to do with the site container and inner site classes?
March 23, 2014 at 6:02 pm #96277garylouMemberHi Brad,
First I want to thank you for taking the time with me, I very much appreciate your assistant and guidance.What I am wanting to do is to create a coffee table book type website.
My home page is the cover for the book, then I have a foreword page, a table of contents page, and a credits page.
The cover page is a total different styling then the other three.
I tried to go in and use different class codes, but things were not laying out right.
And when I style the pages, my blog page is messed up and the sidebar will not show to the right, it will show at the bottom because the text area is too big.
So my thinking was, that if I have a style sheet for each page, then i could leave the main style sheet for the blog.
Now I have another question, if I use the Genesis Child Sample theme, do i need to add anything to the functions page to be up to par?
GaryMarch 23, 2014 at 7:44 pm #96295Brad DaltonParticipantYes but you don't need 4 style sheets http://wpsites.net/wordpress-themes/second-style-sheet-theme/
March 23, 2014 at 8:04 pm #96298garylouMemberThank you Brad, I appreciate your help and guidance.
I am going to give this a try and see how it turns out.
I will send you a link once I have the site up.
Thank you very much
Gary -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.