• Plans & Pricing
  • Log in
  • Get started
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress 
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Get started
  • Sign up
  • Log in
About
  • Plans & Pricing
Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Newsletter
  • Professional Email
  • Website Design Services
  • Commerce
  • WordPress Studio
  • Enterprise WordPress  
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • Support Center
  • WordPress News
  • Business Name Generator
  • Logo Maker
  • Discover New Posts
  • Popular Tags
  • Blog Search
Jetpack App
  • Learn more
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Search
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
Forums / How to Override Hardcoded Uploaded Header Image?

How to Override Hardcoded Uploaded Header Image?

  • Unknown's avatar
    amoore9 · Member · Sep 23, 2012 at 6:29 pm
    • Copy link Copy link
    • Add topic to favorites Add topic to favorites

    It would appear that if I upload a custom logo (header image) through WP’s dynamic styling feature, the url of that image gets hardcoded somewhere in the loop but I can’t figure out where!

    Here is the relevant portion of my header.php:
    `
    <div id="main_container">
    <div id="decoys"></div>
    <div id="header">
    <div id="masthead">
    <div id="branding">
    <div id="blog-title">
    <span>
    <a href="<?php bloginfo( 'url' ) ?>/" title="<?php bloginfo( 'name' ) ?>" rel="home">
    <?php if($custom_logo == 'custom') { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/uploads/<?php echo $custom_logo_image; ?>" border="0" alt="<?php bloginfo( 'name' ) ?>" />
    <?php } else if($custom_logo == 'default') { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/logo.png" border="0" alt="<?php bloginfo( 'name' ) ?>" />
    <?php } else { ?>
    <h1><?php bloginfo('name'); ?></h1>
    <div class="description"><?php bloginfo('description'); ?></div>
    <?php } ?>
    </a>
    </span>
    </div>
    </div><!-- #branding -->

    I see that it's saying that if a custom logo has been specified, that it should grab the image from my template's .../images/uploads folder. When I manually replace the img src="..." portion with a specific url, then it is forced to display that particular image. Otherwise, it displays whatever image I had uploaded previously (through dynamic styling). So my first question is: <strong>where in the labyrinth of WP does it save the url of the previously uploaded header image?</strong>

    <strong>And how do I modify the code below so that it will override whatever else it's being told to do and grab the image I specify in the CSS?</strong> Because right now it won't listen to the parameters that I set in the CSS (making it !important also doesn't seem to work.)
    <code> `
    <?php if($custom_logo == 'custom') { ?>
    <img src="<?php bloginfo('template_directory'); ?>/images/uploads/<?php echo $custom_logo_image; ?>" border="0" alt="<?php bloginfo( 'name' ) ?>" />

    Also, as a corollary, I’ve implemented a style switcher that allows the visitor to toggle between several stylesheets. Each stylesheet features different background colors, fonts, etc but the one thing that I can’t seem to change is the header image (because, like I said before, it seems to be hardcoded somewhere in the loop).

    So if anyone has any advice on how I can modify the above code (and any other possibly relevant codes) so that the header image can be stylesheet-specific and be controlled by the respective .css, I’d really appreciate it!

    Thanks!

  • Unknown's avatar
    supportbot · Member · Sep 23, 2012 at 6:29 pm
    • Copy link Copy link

    You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.

    If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.

    This is an automated message.

  • Unknown's avatar
    amoore9 · Member · Sep 23, 2012 at 6:33 pm
    • Copy link Copy link

    Ergh, sorry for the messed up styling of my post. I placed the code tags in the wrong place but it seems that I’m unable to edit the post….It would also help if there was a “preview post” option…

  • Unknown's avatar
    timethief · Member · Sep 23, 2012 at 6:34 pm
    • Copy link Copy link

    Your site is not hosted on WordPress.COM and you are posting to the wrong support forum. This forum is for support of sites hosted on WordPress.COM.

    Your support questions must be posted to the correct support site for your softwareand that is here http://wordpress.ORG/support/

    For more on the differences: http://support.wordpress.com/com-vs-org/

  • Unknown's avatar
    amoore9 · Member · Sep 23, 2012 at 6:36 pm
    • Copy link Copy link

    Oh, oops…apparently i have posted this in the wrong forum since it does not pertain to a wordpress.com hosted blog. Sorry! Can a moderator please delete this for me? I’ll repost my question to the other more general support forum.Thanks.

  • Unknown's avatar
    timethief · Member · Sep 23, 2012 at 6:37 pm
    • Copy link Copy link

    You’re welcome and best wishes with your site.

  • The topic ‘How to Override Hardcoded Uploaded Header Image?’ is closed to new replies.

Tags

  • alternate stylesheets
  • CSS
  • custom logo
  • Header image
  • header.php
  • stylesheets
  • wordpress.org

About this topic

  • In: Support
  • 3 participants
  • 5 replies
  • Last activity 13 years
  • Latest reply from amoore9

Couldn't find what you needed?

Contact us

Contact us

Get answers from our AI assistant, with access to 24/7 expert human support on paid plans.

Browse our guides

Browse our guides

Find step-by-step solutions to common questions in our comprehensive guides.

WordPress.com

Products
  • WordPress Hosting
  • WordPress for Agencies
  • Become an Affiliate
  • Domain Names
  • AI Website Builder
  • Website Builder
  • Create a Blog
  • Professional Email
  • Website Design Services
  • WordPress Studio
  • Enterprise WordPress
Features
  • Overview
  • WordPress Themes
  • WordPress Plugins
  • WordPress Patterns
  • Google Apps
Resources
  • WordPress.com Blog
  • Business Name Generator
  • Logo Maker
  • WordPress.com Reader
  • Accessibility
  • Remove Subscriptions
Help
  • Support Center
  • Guides
  • Courses
  • Forums
  • Contact
  • Developer Resources
Company
  • About
  • Press
  • Terms of Service
  • Privacy Policy
  • Do Not Sell or Share My Personal Information
  • Privacy Notice for California Users
DeutschEspañolFrançaisBahasa IndonesiaItalianoNederlandsPortuguês do BrasilSvenskaTürkçeРусскийالعربيةעִבְרִית日本語한국어简体中文繁體中文English

Mobile Apps

  • Download on the App Store
  • Get it on Google Play

Social Media

  • WordPress.com on Facebook
  • WordPress.com on X (Twitter)
  • WordPress.com on Instagram
  • WordPress.com on YouTube

Automattic

Automattic
Work With Us
    • WordPress.com Forums
    • Sign up
    • Log in
    • Copy shortlink
    • Report this content
    • Manage subscriptions