I'm customising the default Recent Posts widget so that it displays short post titles from my custom field 'alt_title' instead of the longer standard post titles.
After editing deafult-widgets.php, here's what I have for the list item:
<li><?php $link = get_post_meta($post->id, 'alt_title', true); ?> <a href="<?php the_permalink() ?>"><?php echo $link; ?></a></li>
The problem is that this simply doesn't return anything. The error must be in the returning of the custom field because if I enter a string in the space the list is returned correctly.
I have tried a few different configurations now but can't get this to work. Where am I going wrong when it comes to retrieving my alternative post titles?
Thanks in advance for your help.