How To: Wrap the post title around an image

by Alex

A great way to enhance the style of your images in your post is to have the title of your post wrap around your image. If you don’t understand what that means, then take a look at this post, and just about any other post on Blogussion. I got an email request on how to achieve this effect from our new friend Evan, so I decided that I would just write a post about how to do this.

To achieve this effect, you have to dive into your theme files and do a tiny amount of PHP/HTML/CSS coding. It’s not hard at all, and there is very little coding behind this method. I am sure there are other methods (if not, a plugin) to do this, but this is the way we have grown accustomed to on Blogussion.

Before we start, I just want to run through a checklist of things you need to keep in mind throughout this short little “how-to”:

  • You use WordPress as your blogging platform.
  • A basic understanding of Custom Fields
  • You can edit a theme file

Step 1

Setting up your custom fields

The way I do this is through custom fields. Using custom fields is a great solution to this, because you can set up your image within your post screen without editing any files.

If you need help setting up custom fields, read below. If not, skip to Step 2.

In your post screen, right under your post box is another box called “Custom Fields”. Very self explanatory here: this is where you set up your custom fields.

Inside the custom fields box is an option to create a name for it. Click “Enter New” and enter the name of your custom field. Remember the name, because you will be using it every time you want your title to wrap around an image.
cfields

After you add the Name, click “Add Custom Field”.

Step 2

Adding the code

This is the part where we will be editing the theme files. You will need an FTP program (like Transmit or FileZilla) and a text editor to edit the code (but working inside of WordPress will work just fine).

Go to your themes folder, open up ‘index.php’

Look for the piece of code (usually) directly under The Loop that looks like this:

<div class=”post” id=”post-<?php the_ID(); ?>”>

Directly under that line, add this piece of code:

<div class=”excerpt”>
<?php echo get_post_meta(get_the_ID(), ‘CUSTOM_FIELD_NAME‘, true); ?>
</div>

Replace the part ‘CUSTOM_FIELD_NAME‘ with the name of the custom field you created in Step 1.

Make sure you repeat this process in the single.php file too. That way, the image will show when someone clicks on the title of the post.

Open up your Stylesheet (style.css)

We need to add a very short line of CSS so we can position the image in the right spot for the text to be able to wrap around it.

Paste this code anywhere in your stylesheet:

.excerpt {
float: right;
margin: 0 0 0 2.5em; /* spacing between image and text */
}

You may need to adjust the margin depending on your style sheet.

Don’t understand the margin? You can edit the margin from all different sides in just this one line. It goes in order from left to right: top, right, bottom, left. If it helps you remember, think of margin as “T.R.B.L” – trouble ;)

Step 3

Putting the code to use

Now that all of the code is set up, you can now use your custom fields to make the image of your choice show up.

How to make your image appear

Once you go back to the post screen and write up your post, go back to the Custom Fields screen. Click on the drop down menu and look for the custom field you created earlier and used as the name in your code. Always remember to use this custom field for all of your images, or you may find that some of your images may not show up or disappear.

Now that you have selected the name, edit the box right next to it called Value. You need to enter the image code into this section. You can use this image code below:

<img src=”URL OF IMAGE HERE” alt=”ALT TEXT HERE” title=”TITLE TEXT HERE” />

Use that every time you want to use the image. If you don’t want your title to wrap around an image, then don’t. This code will not have any effect on posts that do not use this method to show its image.

I hope you have learned something. If you have any questions, or can improve this code then let me know!

Back to the top

by

To learn more about this author and see all of their posts, click below.

View Full Profile →

Discover the Real Meaning...

of what it means to master the psychology of your blogging practice. Find out one of the most missed aspects to blogging now, totally free!

Corey Freeman February 21, 2009 at 7:56 pm

It would be significantly easier, i think, to hard code the image code and just paste a URL into the value field. You lose the alt text attribute, but it’s not as annoying to create feature images.

Thumb up 0 Thumb down 0
Alex February 21, 2009 at 8:01 pm

That’s how we have it here, but for the sake of neatness in the tutorial I just decided I would add that tag in the custom field. The only thing I have against that (but I still do it) is that when you don’t have an image with text wrapping, then it will have a blank tag in the source code. It’s not a huge issue, but like I said “neatness”.’ ;)

Thumb up 0 Thumb down 0
Janith February 21, 2009 at 8:08 pm

I didn’t even know we used this method :P
In fact, I don’t know how you managed to set it up – but all I know is ~ it looks good and I can manipulate it :)

Kudos to Alex on setting the Blogussion Theme up, it’s just perfect :)

Thumb up 0 Thumb down 0
Janith February 21, 2009 at 8:06 pm

The ALT Text Attribute is significant when it comes to SEO, because crawlers can’t obviously work out pictures and they play a major role when it comes to identification.

Also, there are many users that use devices to read out loud what is displayed on the site, and a missing ALT attribute fails here as well.

Coming back to a SEO point of view, every image without an ALT tag is a ‘minus’, especially if you have a image-based website or a lot of eye-candy imagery – your site can take a heavy hit on the SERPs.

Thumb up 0 Thumb down 0
Evan February 21, 2009 at 10:39 pm

Thank you for posting this! It answered my question very thoroughly and it it will be very helpful to me and my blog. Once again, thanks! :)

Evan’s last blog post..It’s A Sweet Thing

Thumb up 0 Thumb down 0
Alex February 21, 2009 at 10:42 pm

No problem man. If you need any help, don’t hesitate to ask. :)

Thumb up 0 Thumb down 0
Stuart Conover February 21, 2009 at 10:50 pm

Appreciate the quick guide on how to set this up. I’ve been debating how I want to setup one of my future blogs and this has given me another idea from which route to pick. Of course, having one more option perhaps I should be annoyed that it shall be that harder to choose how I want to style it ;)

Stuart Conover’s last blog post..Review: eCommerce Action Pack by: Jon Lewis

Thumb up 0 Thumb down 0
Alex February 21, 2009 at 11:28 pm

Just keep experimenting. You’ll find something you like. :)

Thumb up 0 Thumb down 0
John Ankarström May 24, 2009 at 8:58 am

How can I do this with Thesis WordPress Theme? You can send an email to me if you respond (forgot to check the notifier checkbox). Thanks.

Thumb up 0 Thumb down 0
Alex May 24, 2009 at 10:46 am

It’s automatically done, go to Thesis Options then Post Images and Thumbnails, you can change how the image shows up.

Thumb up 0 Thumb down 0
John Ankarström May 25, 2009 at 2:14 pm

Oh, thank you! I recently got the Thesis Theme, and I’ve never used the post images and thumbnails before.

John Ankarström’s last blog post..Execute PHP code in posts with WordPress Plugin

Thumb up 0 Thumb down 0
Nick Tart May 25, 2009 at 1:42 am

Do you design/create all of the Post Images for your articles?

Nick Tart’s last blog post..‘Marketing’ Has More P’s Than ‘Hippopotamus’

Thumb up 0 Thumb down 0
Alex May 25, 2009 at 10:54 am

Most of them, but I also use Flickr a lot to find images too.

Thumb up 0 Thumb down 0
Play online casino craps June 11, 2009 at 4:29 am

Awesome stuff. Came to your blog from my friend’s site and wasn’t expecting to find something actually useful. was expecting to just find something random and comment for the do follow love :p being honest :) .I wanted to use something like this in my about page but landed up putting the image below. didn’t realise you could just float it. been using float=”right” but seems like there are a few ways to initialise these things (come from java background so weird that you can use so many methods)

Thumb up 0 Thumb down 0
Mark May 10, 2010 at 9:46 am

You may have not intended to do so, but I about you obtain managed to indicate the state of haul that a oceans of people are in. The common sense of inadequate to escape, but not crafty how or where, is something a straws of us are contemporary through.

Thumb up 0 Thumb down 0
Double Bass Strings May 27, 2010 at 4:12 am

Superb study, I just passed this onto a colleague who was doing just a little study on that. And he really bought me lunch simply because I found it for him smile So allow me rephrase that: Thanks for lunch!

Thumb up 0 Thumb down 0
Alexandra September 3, 2010 at 8:59 am

Wow, nice blog ! Some interesting articles too !

Thumb up 0 Thumb down 0
Fectthef December 15, 2010 at 4:53 am

I should email my pal about this.

sex effects on pregnancy after 38 weeks: amputee sex woman
http://www.alkhanbashi.net/pg/profile/bitchim: lesbian virgin sisters
newhalf sex video: erotic teen sex videos
college $10000 video – pictures girls college
peep shows new york city – nathan bradford peeping
free video adult amateur: free adult amateur girl
http://www.stupidvideos.com/profile/pyqstath: fingering black babe
http://www.chimkulcamp.com/forum/index.php?topic=39372.0: piss in panties
http://www.chimkulcamp.com/forum/index.php?topic=39214.0 – wife fingering herself at home pics
http://www.box.net/shared/rqqp0jg8sx – hudson wisconsin pee wee hockey
http://www.stupidvideos.com/profile/lanstez: girls cumming squirting
sex video of pam anderson: 100 free easy view sex videos
blonde girl pissing: lesbian girls squirting
young latinas scream – sweater movie scream
3d shemale tube: 3d shemale porn
voyeur amateur archive – public sex voyeur
alaska animal webcams: fucking with animals
sexe l’union de la d esse: mtv battle of the sexes
pissing pee stories: vitamin b pills yellow pee
http://www.soompi.com/blog/free-hentai-xxx-galleries: anime free hentai site
,L]

woman sex with animals clips: girls sex boy animals
voyer toilet cam: taja voyeur cams
amateur sex video production: free drunk college amateur sex video
ovalau watersports: oceanline watersports equipment
free preggo pics – ladies shitting pics
peeing alarm: public peeing phobia
cock ring vibrator – chick riding vibrator
porn video voyeur: free upskirt porn videos
teen tranny orgies – shemale tranny celeste
nudist venues london – live sex show venues
amiture porn moms – amiture milf porn pics
forces on pole anchors with wire ropes: free femdom cuckold cartoon
amputee devotee sex – amputee sex tube
kat ana hentai: khamari hentai
http://www.formspring.me/kiqnaz – free black bbw pussy galleries
samuel peep: recipie fur peeps
wass up peeps: village peeps t-shirts
free sex video bathroom – free free free sex videos
dirty scat tubes – black scat white
female pee maye: black lesbians peeing
videos gratuite amateur – ameture wife video
threesome wife videos: amateur video indian milf has threesome with two white men
free online yaoi hentai – hentai free online search
dog knot in woman clips – pain in the butt hunt hints
http://pulse.yahoo.com/_VUMSXJ7SHJ34AZ4LHHATPN7EOA/blog/articles/235377: free shemale 3d vids
anime or hentai mom and very young son incest pics: free anal rape porn videos
free porn rape movies: free real rape movies
blonde teens: blonde lesbian
japanises porn: free porn japanese download
http://www.formspring.me/nyrstyt: students being spanked
free breast bondage videos: free bondage videos of girls getting fucked
http://www.box.net/shared/bl0a4rm6pv – tianna squirts
bleech hentai manga – anime hentai manga free pics
pikemen may hentai – prince of hentai
columbian babe sex video – nadia hilton free sex videos
strict woman caning spanking men – a well deserved spanking
reasons for child sexual abuse: louisiana statute of limitations for child sexual abuse
http://www.chimkulcamp.com/forum/index.php?topic=39496.0 – sexy japanese whore
ba virgin collusion effects: is fergie a virgin
suu upward bound facebook – suu upward bound
amateur anal attempts 2: free anal homemade porn
althetic amateur: homemade young couple sex
images porno gratuites: petites announce gratuite
homemade bdsm: tied bdsm ebony
deflower a virgin – deflowered virgin
,L]

http://cidcie.ubiobio.cl/e-portafolio/portafolio1/wyhstirs/weblog/3609.html: all amateur nymphos 8
http://www.alkhanbashi.net/pg/profile/kopchez: yugioh and hentai
http://www.formspring.me/tafnet – free voyeur upskirt club pictures
http://www.formspring.me/pannym – little boy peeing pictures
http://pulse.yahoo.com/_5VDXJQS4DHJRTVW3YSZW5MOGME/blog/articles/221128: make girl pee flash
http://www.alkhanbashi.net/pg/blog/legstyt/read/6068/gigantic-dildo – tiny women huge dildo
http://www.needsprayer.org/pg/profile/neknir: pregnant chubby nudes thumbnails
http://www.formspring.me/tyjstuth – names of japanese models
http://www.chimkulcamp.com/forum/index.php?topic=39675.0 – ebony ass toying
http://www.alkhanbashi.net/pg/blog/legstyt/read/6065/reciprocating-saw-dildos – prostate dildos
,L]

11

Thumb up 0 Thumb down 0

Comments on this entry are closed.

Previous post:

Next post: