0

I'm using this code to call some custom post meta named port_excerpt:

<?php
global $wp_query;
$postid = $wp_query->post->ID;
echo get_post_meta($postid, 'port_excerpt', true);
?>

This works like a dream when used on the template it is intended for: http://themeforward.com/demo2/portfolio/new-one/. But the custom post template I am using (as in 3.0 custom post templates) is being used for a portfolio, as a result I also need to call this on my portfolio page: http://themeforward.com/demo2/portfolio/

How do I call port_excerpt, which is meta contained within a custom post, on the portfolio page above?

0

You need to put this inside the loop running on the portfolio page.

echo get_post_meta( get_the_ID(), 'port_excerpt', true );
0

Inside your post loop, use $post->ID instead of $wp_query->post->ID. If you could post the loop you're using it would be clearer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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