Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Different BG image for landing page/all other pages (http://forum.bytesforall.com/showthread.php?t=11354)

tnandrick Nov 23, 2010 11:18 PM

Different BG image for landing page/all other pages
 
Using atahualpa 3.4.9

I found forum postings from Flynn about how to create a landing page template. I have the rough structure up @: http://www.reformationcomic.com/

...and yes, I know; it's non-functional. I need to add a couple form elements and a link to allow entry.

The rest of the site is @: http://www.reformationcomic.com/archives/26

I have a fully scalable bg image inserted right underneath the body with an HTML insert. I would like to have different bg images for the landing page, and the rest of the pages. I have read forums about using body.post-id to use different backgrounds for various parts (header, etc) of a page, but since my bg is an html <img> tag for the entire page instead of a traditional CSS bg image, I don't know if this will work. (Although I might be, and probably am, wrong)

Can I use CSS with the existing Atahualpa structure to do what I want? Or perhaps add $var = x on my landing page template, and $var = y on all other pages, and put...

<?php if ($var == x) {<img src == landing page image>

} else {
<img src == other pages image>
}

?>

...within the body top insert section?

Any help is appreciated, and thanks in advance.

T.

juggledad Nov 24, 2010 04:04 AM

instead of doing it the hard way, why not do it like this http://forum.bytesforall.com/showthread.php?t=6833

tnandrick Nov 24, 2010 10:23 AM

Well... (and I'm not trying to be a smart@$$) ...because it's not exactly what I want.

So I will ask a followup:

Is there something within the page I can test against with the if/else? So that in the body top insert section I can do something like:

<?php

$page = page_id; (I don't understand how to extract this info into a $var)

if ($page == *home_page_id*) {
echo "<img src = \"/wp-content/themes/atahualpa/images/*landing_page_bg* \" class = \"bg\" alt = \"background\" />";

} else {
echo "<img src = \"/wp-content/themes/atahualpa/images/*other_page_bg* \" class = \"bg\" alt = \"background\" />";
}

?>

Thanks

juggledad Nov 24, 2010 10:30 AM

Well you can accomplish most things many ways, You probably want to look at the wordpress codex to see the conditional tags available - http://codex.wordpress.org/Conditional_Tags

tnandrick Nov 24, 2010 01:17 PM

I read through the codex about front pages, conditional tags, etc.

However, the code I am using does not work properly.

what I have now (inside html inserts: body top) is:

<?php
if( is_page_template('landingpage.php') ) {
echo '<img src = "/wp-content/themes/atahualpa/images/ReformationSplash.png" class = "bg" alt = "background" />';

} else {
echo '<img src = "/wp-content/themes/atahualpa/images/pulp_paper.jpg" class = "bg" alt = "background" />';

}
?>

I have also tried is_front_page (), and some others that should have worked, including is_page('about') just to try and get it to work. No joy. It will not evaluate the "if" part of the structure as true, no matter what I use.

T

juggledad Nov 29, 2010 11:13 AM

try this
HTML Code:

<?php if ( is_home() ) {
echo '<img src = "/wp-content/themes/atahualpa/images/ReformationSplash.png" class = "bg" alt = "background" />';
} else {
echo '<img src="/wp-content/themes/atahualpa/images/pulp_paper.jpg" class="bg" alt="background" />'; } ?>


tnandrick Dec 8, 2010 06:37 PM

Well almost works... it's at least displaying a different background on:

http://www.reformationcomic/home

but on the page I actually want to use as the landing page:

http://www.reformationcomic/

it still shows the regular background. What's weirder is that when you examine the source for the www.reformationcomic.com page, it says:

<body class="home page page-id-61 page-template page-template-landingpage-php logged-in">

whereas "home" just says:

<body class="blog logged-in">

So somewhere, between WP and Atahualpa, my home page ID is getting mixed up...

juggledad Dec 8, 2010 08:40 PM

The blog page is always 'home' if a static page is the landing page, you should test using is_front_page() this is described in the word press doc. Look at dashboard->settings->reading


All times are GMT -6. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.