This topic is now archived and is closed to further replies.

  • 0

Different Page Templates With Different Background Images


Posted · Report post

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

Share this post

Link to post
Share on other sites

2 answers to this question

Posted · Report post

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:




1 person likes this

Share this post

Link to post
Share on other sites

Posted · Report post

@Simon_P - thanks a lot :)

Share this post

Link to post
Share on other sites