View Full Version : Echo problem in wordpress environment

01-10-2010, 09:11 AM
Hi all,

I'm having a little problem getting an 'echo' to work. The code below works but it shows as domain.com/<?php the_permalink() ?> instead of rendering the URL. I think I have may be missing a single or double quote but not sure.

Here is my code:

<?php $my_query = new WP_Query('showposts=3&offset=1&cat=1'); ?>
<?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
<?php // Generates alternate tile for boxes
$title = get_post_meta($post->ID, "custom-title-value", true);
if ($title != "") {
echo '<li><a href="<?php the_permalink() ?>">'.$title.'</a></li>';
} else { ?>
<li><a href="<?php the_permalink(); ?>"><?php $title = get_the_title(); echo shrink_text($title,27) ?></a></li>
<?php } ?>
<?php endwhile; ?>

Any suggestions greatly appreciated.


01-10-2010, 11:32 AM
echo '<li><a href="'.the_permalink().'">'.$title.'</a></li>';

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum