Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2010-10-30 22:53:04
- mescobosa
- New Member
- Registered: 2005-08-20
- Posts: 9
Is there a way to make the article image a link to the related link?
Hi,
I have a “micro-blog” of sorts where each post is usually a single link somewhere. Sometimes I like to use article images to start the post off with an image, such as a screenshot if the link is to a web app, for example. And it would be so much more intuitive if the image was a link to the link in the post instead of just dead. I notice in the advanced area of the post I can see a field called Related Link that contains the correct url.
How do I make the article image a link to that URL? Do I need a plug-in?
Marc
Offline
Re: Is there a way to make the article image a link to the related link?
If you are storing the external link in a custom field, it could be pretty easy. Take look at couple of tags:
Let’s say, that the custom field’s name is Related Link. If so, you could do something like this in your article form/context:
<!--
Let's check if the article
has a "Related Link"
-->
<txp:if_custom_field name="Related Link">
<!--
If it does have, wrap the article
image in a link
-->
<a href="<txp:custom_field name="Related Link" />">
<txp:article_image />
</a>
<txp:else />
<!--
Nope, we don't have Related Link,
show just the image w/o link
-->
<txp:article_image />
</txp:if_custom_field>
Last edited by Gocom (2010-10-31 00:04:50)
Offline
#3 2010-10-31 00:39:23
- mescobosa
- New Member
- Registered: 2005-08-20
- Posts: 9
Re: Is there a way to make the article image a link to the related link?
Hmmm… I will try that but as far as I know the related link field I am seeing is not a custom field but built in. Does anyone know if that field is built in or not?
Offline
Re: Is there a way to make the article image a link to the related link?
mescobosa wrote:
is not a custom field but built in
No it’s not build in. It’s either a custom field or a feature added by a plugin. You can check TXP’s advanced preferences to see if it is a custom field (TXP/Admin/Preferences/Advanced).
Offline
Re: Is there a way to make the article image a link to the related link?
mescobosa wrote:
Hi,
I have a “micro-blog” of sorts where each post is usually a single link somewhere. Sometimes I like to use article images to start the post off with an image, such as a screenshot if the link is to a web app, for example. And it would be so much more intuitive if the image was a link to the link in the post instead of just dead. I notice in the advanced area of the post I can see a field called Related Link that contains the correct url.
How do I make the article image a link to that URL? Do I need a plug-in?
Marc
Hi Marc
Is this what you need?
<txp:if_article_image>
<txp:permlink><txp:article_image /></txp:permlink>
<txp:else />
<txp:permlink><txp:page_title /></txp:permlink>
</txp:if_article_image>
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
#6 2010-10-31 21:01:55
- mescobosa
- New Member
- Registered: 2005-08-20
- Posts: 9
Re: Is there a way to make the article image a link to the related link?
Gocom wrote:
<!--
Let's check if the article
has a "Related Link"
-->
<txp:if_custom_field name="Related Link">
<!--
If it does have, wrap the article
image in a link
-->
<a href="<txp:custom_field name="Related Link" />">
<txp:article_image />
</a>
<txp:else />
<!--
Nope, we don't have Related Link,
show just the image w/o link
-->
<txp:article_image />
</txp:if_custom_field>
This was it! It was a custom field. No idea when I created that. Thanks a million!
Offline