WordPress.org

Forums

[closed] Display a specific DIV by category in header.php (9 posts)

  1. surgeprotector74
    Blocked
    Posted 1 year ago #

    Well, i have looked and looked everywhere with out a solution to what i would like to achieve. i have seen similar questions posted but none specific to what i think is possible to do with wordpress.

    On my website i have set up different headers to display an image onside the post depending on the category. However, i find it difficult to deal with at times because i had to build so many different header.php files to call on individually. Currently i have a total of 24 header files but i am positive most of these can be eliminated if i can just call on a different div depending on the category. Essentially what i would like to do is go to my main header.php and at the bottom of it where the "content-outer" div is located place an "if" function to call on a specific div that contains the css style i need with the image. Something like this (I have tried several different ways of doing it but no luck thus far).

    <?php if (in_category('Cincinnati Bengals)) { ?>
    <div id="bengals_hdr"></div>
    <?php } elseif (is_category('New York Jets')) { ?>
    <div id="jets_hdr"></div>
    <?php } else { ?>
    <?php } ?>

    So i guess my question is, why can't i place this code inside the "content outer" div to display by category or is my code completely off? My website is http://www.thesidelinereport.com the specific page where you can view the current image on the post is here (Keep in mind currently i am just calling on a specific header by category) i.e, the Miami Dolphins banner above the title: http://www.thesidelinereport.com/2014/04/23/miami-dolphins-mock-draft-1-0/

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    What theme are you using? Where did you download it from?

  3. surgeprotector74
    Blocked
    Posted 1 year ago #

    it's the Gameday theme by Theme Forest but i had to make extensive changes to it to make it work for my content. Everything is up to date and i have downloaded the later version of wordpress so i doubt it is theme related but then again, i could be wrong.

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    I'm sorry but as you are using a commercial theme, you need to seek support from the theme's developer/vendor. We do not support commercial products here.

  5. surgeprotector74
    Blocked
    Posted 1 year ago #

    Well…i am not asking for theme support. I am asking for php code support that works with the wordpress structure. The Theme is not the issue at all it is the use of the "if" statement like the wordpress codex states. Is this not the place to ask for help regarding wordpress codex?

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    We do not have access to commercial themes, so there is no way that we can determine what will - or will not - work in your theme. Additionally, the wordpress.org support forums are meant for the core application, themes and plugins that are distributed on wordpress.org. We do not support themes downloaded from elsewhere.

  7. esmi
    Forum Moderator
    Posted 1 year ago #

    I'd also suggest that you review http://codex.wordpress.org/Forum_Welcome#The_Bad_Stuff with a specific reference to the last bullet point.

  8. surgeprotector74
    Blocked
    Posted 1 year ago #

    So to understand completely and if anyone else has a code question, I cannot come here to discuss the wordpress codex even though i am using the WordPress CMS because i am not using a free theme from WordPress? Interesting…so if i make my own theme and use WordPress as the CMS i cannot ask any questions here about the codex either. For the record…i am not asking IF THE CODE WILL WORK ON MY THEME, i am asking if the code is the correct format for wordpress…but hey i don't have a free theme

  9. esmi
    Forum Moderator
    Posted 1 year ago #

    It should really go without saying, but the following are likely candidates for moderation -
    [...]
    Ask for help regarding premium themes/plugins. We do NOT support premium themes as you paid for their support when you bought it and it is not our place to keep vendors in business. If someone wants to help, that is fine.

    http://codex.wordpress.org/Forum_Welcome#The_Bad_Stuff

    so if i make my own theme and use WordPress as the CMS i cannot ask any questions here about the codex either.

    When you do make your own theme & run into issues with your coding, we'd be more than happy to help.

Topic Closed

This topic has been closed to new replies.

About this Topic