How to Replace Post title text with image?

Discussion in 'WordPress' started by MiletNZ, Sep 26, 2010.

  1. #1
    I want to replace my posts boring text titles with image headers that I've made for each post. How can I do this?
     
    MiletNZ, Sep 26, 2010 IP
  2. deluxdon

    deluxdon Catch Me If You Can...!!!™ Staff

    Messages:
    25,482
    Likes Received:
    1,943
    Best Answers:
    32
    Trophy Points:
    480
    #2
    You need to change that under 'post-title' tag in index.php and single.php

    DON.
     
    deluxdon, Sep 26, 2010 IP
  3. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Each theme is coded differently, some use h2 tags some use h3 etc

    find in archives.php and index.php
    <h3"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
    Code (markup):
    replace with
    <img src="<?php echo get_post_meta($post->ID,’postheader’, true) ?>" />
    Code (markup):
    now when you create a new post you need to create custom field named 'postheader' the value of this custom field should be a url to your header image.

    also if you want the image linked to the page use
    <h3"><a href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID,’postheader’, true) ?>" /></a></h3>
    Code (markup):
     
    Last edited: Sep 27, 2010
    just-4-teens, Sep 27, 2010 IP
  4. bob25

    bob25 Well-Known Member

    Messages:
    1,519
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    128
    #4
    bob25, Sep 27, 2010 IP
  5. MiletNZ

    MiletNZ Member

    Messages:
    283
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #5
    Thanks heaps, exactly what I was looking for
     
    MiletNZ, Sep 27, 2010 IP
  6. just-4-teens

    just-4-teens Peon

    Messages:
    3,967
    Likes Received:
    168
    Best Answers:
    0
    Trophy Points:
    0
    #6
    no worries, just realised you may need to edit the image tag to remove the border set width etc
     
    just-4-teens, Sep 27, 2010 IP
  7. MiletNZ

    MiletNZ Member

    Messages:
    283
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    30
    #7

    Ah yeah I can handle that :)
     
    MiletNZ, Sep 27, 2010 IP