PDA

View Full Version : How to Disable Caption on Homepage but not Post?



mlsg04
11-19-2009, 11:48 PM
Hi,

I'm just wondering is there any way I can disable the image caption on my blog homepage but not in the individual blog post?

At the homepage of my blog - eHomepreneur.com (http://ehomepreneur.com/) see the post of "Setting up Your Dream Home Office" (http://ehomepreneur.com/setting-up-your-dream-home-office/), the image caption "Source: HGTV.com Designers' Portfolio" appear on the first line which doesn't make sense to readers when they are scanning the page.

Anyone has any idea how to do it?

Appreciate any input. Thank you.

morestar
11-20-2009, 10:22 AM
Interesting. It's taking the first few paragraphs of text and displaying it on the homepage so since that HGTV text is the first text, it's taking that text.

I'm right now in my wordpress account and I can't see how you would change that and I don't believe you can at all. Again, it's taking the first few sentences from the post and displaying it on the home page.

If anything you would have to move that text to another location in the post.

However, I'm trying to think of a little hack for you...

morestar
11-20-2009, 10:26 AM
ahhhhh, take out the caption and throw the HGTV.com information, in light grey text, into the image itself, in the bottom left hand corner...

ronchalice
11-20-2009, 04:43 PM
You should be able to create different CSS for the index.php page and the page.php page with different attributes for the "caption" class.

It might depend on the template you're using.

morestar
11-20-2009, 04:49 PM
It seems though that the code on the home page is simply grabbing text within the post, the first text that is and in this case it's the HGTV text. I'm not sure he's going to be able to simply code;

if text = HGTV display:none

you know what I mean though...

No matter what text is in the post, the first few sentences will be on the homepage preview...

FoundByDesign
11-20-2009, 05:11 PM
Since you are using excepts anything you put in your captions will be seen as text within your excerpts. Solution... Change caption to reflect the post and add (1) to designate a footnote. Then at the end of your post create a simple line in italics that reads: (1)image credit: HGTV

kettlewell
11-20-2009, 06:50 PM
You'll need to slip into your theme, and use some PHP conditional tags to include/exclude content based on the page you're viewing.

Here's the authority page on the subject:
Conditional Tags wordpress Codex (http://codex.wordpress.org/Conditional_Tags)


something like this should work, but the exact use depends on your theme...



// if some page other than home
<?php if (!is_home()) { ?>
<p>caption goes here</p>
<?php } else { ?>
<!-- can be blank for homepage -->
<?php } ?>


There are other conditionals besides is_home() that can be used, but this should get you started.

PS - if the above formatting doesn't look right, checkout the wordpress link, it has similar code examples that should help.

Matt

scot184
11-20-2009, 10:12 PM
As an aside, shouldn't you cite the photo regardless of where it shows up on your blog. Wouldn't that be the best way to show attribution?

morestar
11-20-2009, 10:13 PM
yes but as he mentioned, on his home page it's displaying right beside the paragraph copy which indeed does look funny and could be confusing to a user...

we're all perfectionists at times...

morestar
11-20-2009, 10:18 PM
something like this should work, but the exact use depends on your theme...



// if some page other than home
<?php if (!is_home()) { ?>
<p>caption goes here</p>
<?php } else { ?>
<!-- can be blank for homepage -->
<?php } ?>


There are other conditionals besides is_home() that can be used, but this should get you started.

PS - if the above formatting doesn't look right, checkout the wordpress link, it has similar code examples that should help.

Matt

I have a strong feeling this won't work - the caption is set when the user uploads an image...in wordpress...if coding it will work, he would have to some way catch the caption and then if it's the homepage, don't show the caption and if it isn't the homepage, show it...

This might be difficult.

I hope if mlsg04 finds the solution he posts it here...

scot184
11-21-2009, 12:51 AM
Oh okay I see...personally, I think the site would look better if there were thumbnail photos accompanying the snippets on the front page. Maybe that would resolve the issue and make the site more attractive.

mlsg04
11-21-2009, 05:28 AM
Thanks all for the reply. I'm not well-versed in programming so changing the code or stylesheet is really beyond me.

FoundByDesign gave a good solution, may be that's the fastest way to solve the problem but I still hope the attribution is near where the images is it is fair for the original author.

May be another way is to change the theme. I agree with what scot184, having a thumbnail photos on the front page will make the site look attractive. But so far this theme serves most of what I want, it is not easy to find a perfect theme.

Thanks all again for the good suggestions.

morestar
11-21-2009, 11:44 AM
Ok well I hope this helps.

I'm suggesting that you add a period right after the words "Source: HGTV.com Designers' Portfolio" so that when it displays on the homepage, it at least looks like a sentence.

or

download and use this image with the citation placed in the image and then remove the textual citation from the post:

http://www.morestar.ca/images/Kim-Ammie-Brown-Office_lg.jpg

Hope this helps...

mlsg04
11-22-2009, 05:15 AM
Thanks morestar, that's a good one. Really appreciate you took the time to create the sample. I understand your point but I thought I could reuse the URL given in the HGTV.com so to save the time but didn't know the caption gave me such problem.

Once again, thank you for your advice, I will go for the quick fix, add a full stop first. :-)

morestar
11-22-2009, 11:44 AM
Not a problem mlsg, we like helping people at WebProWorld plus it only took me about 12 seconds = )