0

I've installed a plugin for Wordpress Titled "CMS Press" onto my Site.

I have created two custom fields within a custom post I've called "The Team"

The code for the page is as follows :

<div class="span16"> <!-- This is column 1 -->

            <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>

            <div class="pagehead"><h2 class="title_page"><?php echo get_post_meta($post->ID, 'title_page', true);?></h2></div>

            <div class="span6 subcontent">
                <?php 
                        $args = array ('post_type' => 'team');
                        $lastposts = get_posts( $args );
                            foreach($lastposts as $post) : setup_postdata($post); ?>
                                <div class="teamsubhead">
                                    <h2 class="team_page"><?php the_title(); ?></h2>
                                    <h3 class="job_title"><?php get_post_meta($post->ID, 'jobtitle', true); ?></h3>
                                </div>
                            <?php the_content(); ?>
                <?php endforeach; ?>                    
            </div>

           <?php endwhile; ?>
     </div>

The custom field I created in my custom post is called "jobtitle" I am trying to retrieve that from this line of code

<h3 class="job_title"><?php get_post_meta($post->ID, 'jobtitle', true); ?></h3>

However nothing is getting output at all.

Can someone help me with this. I suspect it may be something to do with the loop and my new query being in a new loop?

Thanks in advance.

1 Answer 1

1

Try it with echo at the beginning:

<?php echo get_post_meta($post->ID, 'jobtitle', true); ?>

Sign up to request clarification or add additional context in comments.

1 Comment

Urgh! That hurts knowing how simple that could have been. Many Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.