Display specific info in a list item based on post's custom field?
-
Hello, your plugin is serving me well on several projects! I now have a question about whether the following is possible, can W4PL display specific info in a list item based on whether the post has a particular custom field with data?
A client has a video site on which I have created a compact listing displaying video thumbnails, video title, and excerpt much like the way you would see a mobile app dedicated to news. They generally have a shorter “preview” video (average 1 min 30 sec ) and a longer “full” version of the video (average 15 min). I have set the Home page listing to display only preview video listings of various categories.
The client would like to have a link on each list item to be able to link to the full video version for those that have them. I have created a custom field (“full_version”) within the preview video posts that has the URL to the full version video and modified my template to display
<a href="[post_meta key="full_version"]" >View full version of video</a>
in the video title. However, this currently appears on all the list items whether or not the post has the relevant custom field. I want to know if it would be possible to only display this link only if a post has that specific “full_version” custom field entered with data. If so, would you be able to provide a guide as how to do this?My full template for reference below.
Regards,
Frank<ul class="home-list"> [posts] <li class="home-brief-article"> <div class="home-brief-thumb"><a href="[post_permalink]">[post_thumbnail width="60px" height="60px"]</a></div> <div class="home-brief-title-and-excerpt"> <h2 class="post-title"><a href="[post_permalink]">[post_title]</a> <em class="link-full">- <a href="[post_meta key="full_version"]" >View full version of video</a></em></h2> <p class="home-excerpt">[post_excerpt wordlimit="20"]</p> </div> <div style="clear:both;"></div></li> [/posts] </ul>
- The topic ‘Display specific info in a list item based on post's custom field?’ is closed to new replies.