WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top


I'm using the above tutorial to build custom portfolio pages. The custom portfolio pages are working... but I can't figure out how to display the Website URL I enter in my custom post meta field (website_url).

Shouldn't <?php echo $website_url; ?> work?

How do I call specific post meta? The normal call for all post_meta is <?php the_meta(); ?>, but what if I just want to call a specific piece of it (website_url in this example)?

share|improve this question
up vote 0 down vote accepted

you can use <?=$website_url?> in the portfolio template like

<strong>URL: </strong><a href="<?=$website_url?>"><?=$website_url?></a>

to make it like follow

Template Name: Portfolio
<?php get_header(); ?>
    <div id="content">
        $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => 10)); 
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
        $custom = get_post_custom($post->ID);
        $screenshot_url = $custom["screenshot_url"][0];
        $website_url = $custom["website_url"][0];
        <div id="portfolio-item">
        <h1><?php the_title(); ?></h1>
        <a href="<?=$website_url?>"><?php the_post_thumbnail(); ?> </a>
        <strong>URL: </strong><a href="<?=$website_url?>"><?=$website_url?></a>
        <?php the_content(); ?>
        <?php endwhile; ?>  
        </div><!-- #content -->
<?php get_footer(); ?>

You can change the placement to match your standers

share|improve this answer
did you find it use full if so please mark it as a correct answer. – phantom.omaga Nov 5 '11 at 6:58

Assuming you are inside the loop:

$website_url = get_post_meta( $post->ID, 'website_url', true );

Where $post->ID is the id of the current post. Either accessed by the $post global or the_ID() / get_the_ID() or some other method.

share|improve this answer

Your Answer


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.