Jump to content
devinchopra

Different Page Templates With Different Background Images

Recommended Posts

devinchopra    0
devinchopra

I need to create 4 page templates, and each one needs to have a different background image.

 

I know this can be achieved using WordPress' conditional PHP tags (in the header.php file) to determine the page template being used and change the CSS file accordingly. But how can I do this in PageLines?

 

I figured I would use the page templates available by default (Template | 1, Template | 2, ...) and have a different CSS file for all of them.

 

Then using conditional tags I would determine which CSS file to apply to which page template and thus have different background images on all the pages.

 

It would really make my life easier if this could be acheived using a plugin, so if you have any thoughts about that, please let me know.

 

Thanks in advance

 

Devin :)


Wordpress Sites - starting at $199 - www.dZaine.in

Share this post


Link to post
Share on other sites
Simon    247
Simon

Thats a hugely complicated solution!!!

 

If you view the source html of your page, just below the </head> tag you will see the body tag.

 

WordPress fills this tag with special classes depending on what page you are on. Here is an example:

 

 

<body class="page page-id-38 page-template page-template-page-alpha-php logged-in admin-bar no-customize-support custom responsive pagelines-template-theme alpha fixed_width navbar_fixed">

Now the parts we are intereted in are the page ID and the page template:

 

page-id-38 <= so if you use this class in css, the css will be for this page/post only.

 

page-template-page-alpha-php <= any css with this class will affect all pages using this template.

 

The templates are:

 

alpha
beta
gamma
delta

epsilon

  • Like 1

Share this post


Link to post
Share on other sites
devinchopra    0
devinchopra

@Simon_P - thanks a lot :)


Wordpress Sites - starting at $199 - www.dZaine.in

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×