Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I´d like to echo the post name instead post id. My code shows just the id.

<?php 
global $post;
$customlink = get_post_meta( $post->ID, 'clink', true ); 
echo $customlink;
?>

Thanks
Ogni

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

Does this meta field store some other post's ID, of which you want to retrieve the post name?

If so, try this

<?php 
global $post;
$customlink = get_post_meta( $post->ID, 'clink', true );

echo get_post_field( 'post_name', $customlink );
?>
share|improve this answer
    
Perfect - thanks –  ogni Dec 17 '12 at 14:52
add comment
<?php 
global $post;
echo $post->post_title;
// or even better
echo apply_filters('the_title',$post->post_title);
?>

Like that?

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.