Jump to content


Photo
- - - - -

Different Page Templates With Different Background Images


Best Answer Simon_P , 06 December 2012 - 05:15 PM

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

Go to the full post


  • Please log in to reply
2 replies to this topic

#1 devinchopra

devinchopra

    Newbie

  • Members
  • 4 posts
  • LocationIndia
  • Framework Version:2.3.3
  • Country: Country Flag

Posted 06 December 2012 - 04:49 PM

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 :)



#2 Simon_P

Simon_P

    Messer

  • Administrators
  • 8388607 posts
  • LocationDevon
  • Framework Version:2.0
  • Country: Country Flag

Posted 06 December 2012 - 05:15 PM   Best Answer

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:

 

 

Please Login or Register to see this Hidden Content

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

 

Please Login or Register to see this Hidden Content

 

Please Login or Register to see this Hidden Content

 

The templates are:

 

alpha
beta
gamma
delta

epsilon


  • devinchopra likes this

#3 devinchopra

devinchopra

    Newbie

  • Members
  • 4 posts
  • LocationIndia
  • Framework Version:2.3.3
  • Country: Country Flag

Posted 06 December 2012 - 05:51 PM

@Simon_P - thanks a lot :)