I have a Wordpress theme bought from a well known site. I'm trying to change the location of the main site logo to where the page/post titles appear.

The page.php for the title is as follows;

How would I add an image to this?

<div class="clear headtop" style="height: auto;">
    <div class="page-title" style="width: 100%; margin-bottom: 40px;">
        <h1 class="vfont"><?php the_title(); ?></h1>

the site url is http://www.djdavestewart.com/site/sound-system-hire/

Thanks for your help


  • If you want to use a different image for each page or post, simply use img src="link_to_image" in the title. Easy! – Rudy Dec 6 '17 at 17:07

I would actually handle this with CSS. In your style.css file add something like this:

.page-title h1 {
    text-indent: -9999px;
    background: url(images/your_logo.png) 10px 10px no-repeat;
    height: 100%;

You'll then make sure that your logo is added to your theme's images folder. Also, adjust the size of the image accordingly, or you can also adjust the size of the container.

Notice the two 10px values. That's your top / left offset (I just picked a couple values to show you those). Adjust those to your liking.

Hope that helps a bit, have fun!


There are several ways to do this:

  1. You can add imaged directly when creating post. For example, in the "Title" box, I could put Blah blah blah.
  2. If you want to do this for all multiple posts, it will probably get tedious to repeat this for every post. Instead, you can modify the title in the backed (in the loop) before outputting it:

    $title = get_the_title();
    $new_title = '<img src="'. get_template_directory_uri() .'/images/blah.png">' . $title; ?>
    <h1 class="vfont"><?php echo $new_title; ?></h1>
  3. You can apply a filter to the title:

    add_filter('the_title', function($title){ 
        $title = '<img src="'. get_template_directory_uri() .'/images/blah.png">' . $title;
        return $title;
    }); ?>
    <h1 class="vfont"><?php the_title(); ?></h1>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.