Hi ! I want to edit a wordpress theme and add an image to the header.php ( line 74 <a href="http://www.yourlinkhere.com"><img src="images/AJTFixPreisBanner.jpg"></a>) but i only get the image broken down sign when when i go online. Is it because i do not insert the picture with a php function ? Should the picture be png format ? Something wrong with the picture url , i mean the picture is inside images folder which is in the same folder like header.php so the relative url should be right Help please

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up until id="main-core".
 *
 * @package ThinkUpThemes
 */
?><!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <?php thinkup_hook_header(); ?> <meta charset="<?php bloginfo( 'charset' ); ?>" /> <meta name="viewport" content="width=device-width" /> <link rel="profile" href="//gmpg.org/xfn/11" /> <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> <!--[if lt IE 9]> <script src="<?php echo get_template_directory_uri(); ?>/lib/scripts/html5.js" type="text/javascript"></script> <![endif]--> <?php wp_head(); ?> </head> <body <?php body_class(); ?><?php thinkup_bodystyle(); ?>> <div id="body-core" class="hfeed site"> <header id="site-header"> <?php if ( get_header_image() ) : ?> <div class="custom-header"><img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt=""></div> <?php endif; // End header image check. ?> <div id="pre-header"> <div class="wrap-safari"> <div id="pre-header-core" class="main-navigation"> <?php if ( has_nav_menu( 'pre_header_menu' ) ) : ?> <?php wp_nav_menu( array( 'container_class' => 'header-links', 'container_id' => 'pre-header-links-inner', 'theme_location' => 'pre_header_menu' ) ); ?> <?php endif; ?> <?php /* Header Search */ thinkup_input_headersearch(); ?> <?php /* Social Media Icons */ thinkup_input_socialmedia(); ?> </div> </div> </div> <!-- #pre-header --> <div id="header"> <div id="header-core"> <div id="logo"> <a rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php /* Custom Logo */ thinkup_custom_logo(); ?></a> </div> <div id="header-links" class="main-navigation"> <div id="header-links-inner" class="header-links"> <?php wp_nav_menu(array('container' => false, 'theme_location'  => 'header_menu' ) ); ?> </div> </div> <!-- #header-links .main-navigation --> <?php /* Add responsive header menu */ thinkup_input_responsivehtml(); ?> </div> </div> <!-- #header --> <?php /* Custom Slider */ thinkup_input_sliderhome(); ?> </header> <!-- header --> <a href="http://www.yourlinkhere.com"><img src="images/AJTFixPreisBanner.jpg"></a> <?php /*  Call To Action - Intro */ thinkup_input_ctaintro(); ?> <?php /*  Pre-Designed HomePage Content */ thinkup_input_homepagesection(); ?> <div id="content"> <div id="content-core"> <div id="main"> <?php /* Custom Intro */ thinkup_custom_intro(); ?> <div id="main-core">
Member Avatar for diafol

Is that how your code looks all mixed up like that? Not sure that's readable.

I don't know if you're using a child theme, but if you do (and you should) then you should make a copy of header.php and place this copy in your child theme directory. In this header.php file you make your edits or additions such as your img src.
Also place your 'images' folder in your child theme directory too and then you can use the following line to retrieve the image.

<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/AJTFixPreisBanner.jpg" />

This is why I hate WordPress. They totally misuse PHP, mixing their PHP and HTML code. I would fire the lot of their developers if I was a senior/principal/managing engineer there. PHP should be written much like C++. Place the HTML and other client-side code (javascript, etc) in string variables within a class method. Once it is fully formed, then output the method data. There are several advantages to this. First is that you can debug it. Next is that it is a LOT more efficient time-wise since there is only one large message from server to client, and not a gazillion small ones. Suddenly, adding an image to the header becomes a trivial exercise.

Member Avatar for diafol

@rubberman So true. However the WP team has set up the platform for non-coders. It's a mess for experienced coders but supposedly easy for everybody else. I'm not totally convinced

commented: I am definitely not convinced! :-) +14

@diafol - WP could fix this if they wanted to make the effort. It isn't rocket science, just simple object-oriented programming. I did a lot of PHP at Nokia, including fixing up other folks' code that was in the WP mish-mosh format. Gee, after rewriting the code, suddenly we had a 2-order-of-magnitude speed up in client response! Complex stuff that took minutes to render suddenly took a couple of seconds. My QA director thought there was something wrong! Nope. Just something quite right! He loved me after that because stuff that used to take him 2 weeks to analyze (new phone firmware for example) was now only taking him a few hours! His group was able to increase their workflow tremendously, and with less effort!

commented: Clean code and design that runs faster? I like it. +12
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.