Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Set different headers for each page (http://forum.bytesforall.com/showthread.php?t=1485)

curious Apr 30, 2009 02:44 AM

Set different headers for each page
 
Hello,

can I set different headers (images-area) for each page without using a plugin?

Or otherwise can I use this plugin called "Dynamic Headers".

http://wordpress.org/extend/plugins/dynamic-headers/

My results using this plugin ended at this point:
After installing the plugIn, I paste this code "<?php show_media_header(); ?>" into the header.php.
The result is that the header-images (I added them for dynamic header in another directory (/wp-content/plugins/dynamic-headers/header-images/) are shown above the "logo" Area and the image area, and not in the "Image" area. The Image-Area leaves blank. This is not, what I want.
The order I use in my header area is " %logo" and than "%image".

greetings,

curious

Flynn Apr 30, 2009 02:07 PM

Remove %image from the theme settings

curious Apr 30, 2009 02:32 PM

Hi flynn,

that doesn't work:-(


The choosen test-Headerimage is over the logo area again (after removing %image from the theme settings).
(as: "Bild1" in my attachment).

I want the solution like you see it on "Bild 2", with the choosen test-image inside yor headerimage- container (with the transparency left and right).

Flynn Apr 30, 2009 07:07 PM

You should be able to do this with a CSS Insert

Look into the source for the ID and various classes that the <BODY> tag gets on every page, and use that to address the header image container for each page separately.

HTML Code:

/* default */
div.header-image-container {
background: url(/wp-content/themes/atahualpa332/images/header/image1.gif) !important;
}
/* homepage */
body#body-frontpage div.header-image-container {
background: url(/wp-content/themes/atahualpa332/images/header/image2.gif) !important;
}
/* static page or single post page with ID 106 */
body#body-page-106 div.header-image-container {
background: url(/wp-content/themes/atahualpa332/images/header/image3.gif) !important;
}
/* all archive pages for December */
body.December div.header-image-container {
background: url(/wp-content/themes/atahualpa332/images/header/image4.gif) !important;
}

If this does not overwrite the inline style that the header-image-container gets, you'd have to edit bfa_header_config.php and replace

PHP Code:

$header_image '<div class="header-image-container" style="background: url(' $selected_header_image ') ' $bfa_ata_headerimage_alignment ' no-repeat;">'

with

PHP Code:

$header_image '<div class="header-image-container">'


curious May 1, 2009 01:12 AM

Hi flinn,

I'm sorry to tell...

First I dissable the Plug_In "Dynamic Headers".

Than I copy your CSS Insert (with my Page-ID's) into the style.css.
Result:The header-image area is empty.

Than, in addition I overwrite the part in the bfa_header_config.php with your code.
Result:The header-image area is empty, too.

Than I checked it out with only the modified bfa_header_config.php. Same result...

greetings,
curious

Flynn May 1, 2009 03:46 AM

Post or PM a URL please

curious May 1, 2009 07:32 AM

hi Flynn,

sorry, i was blinded by science... uoohmp. I forgot to complete your Css-Code with the correct URL's from my images. After completing the correct URL-pathes in the style.ccs., all works really fine!

So again, thank you very much, for showing me the RIGHT solution.


greetings,

curious

machepap May 7, 2009 08:36 AM

Hi,

I am having a similar issue, trying to follow along with this instruction, but I'm doing something wrong because I'm still getting a blank header image area.

Feel like taking a look? I'd greatly appreciate it.

here's the site, homepage and one other page so far.

thanks,

Amy

Flynn May 7, 2009 09:54 AM

I see a header image (the same) on both of these URLs

machepap May 7, 2009 10:08 AM

Yes,

Since my post, I found a mistake in the path to the images - I had "atahualpa332" (as in the example given) but my directory was just "atahualpa"

After making this change, the default/home page image is showing for all images. Perhaps I'm not naming the body id correctly for the other page in the added CSS? The path to the image is correct.

Flynn May 7, 2009 10:21 AM

You don't have these body classes in your older theme version. Body classes were added in 3.3.2

machepap May 7, 2009 10:32 AM

Right, sorry if I wasn't clear - I was pasting code that you had written (above in this thread) and had to remove the "332" to correct the path to the images. When I did this, the default image showed up. But, unfortunately, the image that I want for this page is showing up as the same default image, even though I've given a path to a different image for that page.

Thanks for your help!

machepap May 7, 2009 10:36 AM

OH!

Just reread your response. I think I understand now - what I'm trying to do won't work with the version I am using. What do you recommend? I'm a little afraid of upgrading versions, as I've never done this before and I'm not sure what it entails. I don't need these header images to be editable. Is there a way I can hard-code the pages with my chosen images?

Thanks again!

Flynn May 7, 2009 03:54 PM

1. Change in header.php

PHP Code:

<body<?php echo ($bfa_ata['html_inserts_body_tag'] != "" ' ' apply_filters(widget_text$bfa_ata['html_inserts_body_tag']) : ''); ?>>

to

PHP Code:

<body<?php bodyclasses(); ?><?php echo ($bfa_ata['html_inserts_body_tag'] != "" ' ' apply_filters(widget_text$bfa_ata['html_inserts_body_tag']) : ''); ?>>

2. In functions.php add this

PHP Code:

include_once (TEMPLATEPATH '/functions/bfa_bodyclasses.php'); 

where already a dozen or so of these lines are,

3. Create a file named bfa_bodyclasses.php with the content shown below, and upload it as /atahualpa/functions/bfa_bodyclasses.php

PHP Code:

<?php

// This adds classes to all, and an ID to most <BODY> tags
function bodyclasses() {

    global 
$post;
    
    if ( 
is_home() ) { 
        
$body_classes "body-homepage";
        if ( 
is_paged() ) {
            
$body_id "body-homepage-" $paged$body_classes .= " body-homepage-paged body-paged"
        }
        else 
            
$body_id "body-homepage"
    }
    
    if ( 
function_exists('is_front_page') ) {
        if ( 
is_front_page() ) 
            
$body_id "body-frontpage"
    }
        
    if ( 
is_page() ) 
        
$body_id "body-page-" $post->ID$body_classes .=" body-page"
        
    if ( 
is_single() ) 
        
$body_id "body-post-" $post->ID$body_classes .=" body-post"
    
    if ( 
is_category() ) {
        
$body_classes .= " category";
        if ( 
is_paged() ) {
            
$body_id "body-cat-" intvalget_query_var('cat') ) . "-" 
            
$paged$body_classes .=" body-category-paged body-paged"
        }
        else 
            
$body_id "body-cat-" intvalget_query_var('cat') ); 
    }

    if ( 
is_year() OR is_month() ) 
        
$body_classes .= " body-archive" single_month_title(' 'false);
    
    if ( 
is_search() ) 
        
$body_classes .= " body-search";
    
    if ( 
is_404() ) 
        
$body_classes .= " body-error";
    
    if ( 
is_date() ) $body_classes .= " body-date";

    if ( 
is_author() ) 
        
$body_classes .= " body-author";
    
    if ( 
function_exists('is_tag') ) {
        if ( 
is_tag() ) 
            
$body_classes .= " body-tag";
    }

    if ( 
is_page() OR is_single() ) {
        
$custom_fields get_post_custom($post->ID);
        if (
$my_custom_field $custom_fields['bfa_body_class']) {
            foreach ( 
$my_custom_field as $key => $value )
            
$body_classes .= $value";
        }
    }
    
    
$body_classes trim($body_classes);
    echo ( (
$body_id != '') ? " id=\"$body_id\"" '') . " class=\"$body_classes\"";

}
?>


machepap May 7, 2009 04:35 PM

Yes!

I did exactly as you said, and it works! Fast and easy. Thank you thank you thank you.

You have saved me hours of aggravation

:):):)

martins May 20, 2009 12:03 AM

hello!
i did every thing from editing css to creating bfa_header_config.php. got pretty much the same problems like everybody else. finally it seems that it works.
problem is that nggallery flash plugin doesnt want to work together with these new features. i even cant access dashbord. i am getting following message on screen:


Warning: Cannot modify header information - headers already sent by (output started at /home/northci1/public_html/wp-content/themes/atahualpa/functions/bfa_bodyclasses.php:69) in /home/northci1/public_html/wp-includes/pluggable.php on line 850

page btw is working fine and headers are changing exactly like they should. apart from slide shows which are eternally loading.
but to access admin area and continue to work on my page i have to upload old header.php and functions.php and my different headers are lost. then i can deactivate flash plugin, but i need it too :confused:

Ruzzian May 27, 2009 04:30 PM

I am trying to get dynamic headers to work and found this thread. Is it possible to use Dynamic Headers to make this work? I was trying to avoid coding if possible.

tiber Jun 19, 2009 04:53 PM

Hello guys,

I also am looking to set 'static' headers for individual pages... we'll be using the pages to showcase specific items and would like the image to correspond with the content for that page.

That sounds fairly straightforward to me, however it seems by looking through this thread that's not exactly the case.

Being new to Wordpress (and this theme of course) I've tried to follow along in what's posted here but to no avail.

Is there a chance of getting a complete, single post of what should be done to allow for this functionality? If this post were to be targeted at the lowest level of understanding things of this nature that would be great.
This poor network guy is wading through web creation.

Thank you in advance for any light shed on this!


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

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