ThemeShaper Forums » Thematic


abovecontent on Category pages?

(3 posts)
  • Started 11 years ago by squidz
  • Latest reply from squidz
  • This topic is not resolved
  1. I have a set of images I'm slipping into "thematic_abovecontent" with the function below. It's not really efficient php, but it's what I currently understand.

    I need to add onto this so that I can also drop in images via that hook for certain category pages such as "news." But I cannot figure out how to integrate that. Anyone willing to point me in the right direction?

    // insert graphic space abovecontent
    function photo_banner(){ 
    if(is_page() & !is_paged()) { ?>
    <div id="photobanner"><?php
            if (is_page('home')) {
                $banners ='ph_hm.jpg';
                elseif ( is_page('about') ) {
                $banners = 'ph_mike_meeting.jpg';
                elseif ( is_page('resources') ) {
                $banners = 'ph_books.jpg';
                elseif ( is_page('our-practice-areas') ) {
                $banners = 'ph_mich_client.jpg';
                elseif ( is_page('what-clients-say-about-us') ) {
                $banners = 'ph_sam_board.jpg';
                elseif ( is_page('contact-us') ) {
                $banners = 'ph_mmm.jpg';
                elseif ( is_page('blog') ) {
                $banners = 'ph_blog.jpg';
                ?><img src="<?php echo bloginfo('stylesheet_directory') . '/images/banners/' . $banners; ?>" /></div>
    <?php }
    Posted 11 years ago #
  2. well thematic_abovecontent() exists on category pages too... so i think the problem is none of your conditional if statements are TRUE on a category page, therefore no image banner displays.

    try an is_category() condition

    OR include a final

    else { $banners = 'ph_default.jpg';  }

    to your conditional to catch anything not explicitly defined

    Posted 11 years ago #
  3. Thanks HtV - I managed to clean up the code I had above and strip out the redundancy. That allowed me to set in the is_category for my news section as well as is_home for the blog page. Once I get a little better handle on php it will make using WP and Thematic so much easier. Most of my time is spent troubleshooting the php bits by trial and error. The desire to keep my hands in functions.php rather than duplicating templates for child theme mods has been a little challenging in that regard.

    Now if I could find a solution to removing the current-page-item of "Blog" from my News and Author sections and properly apply it to their nav buttons, I'd be rockin'.

    Posted 11 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.