WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] posts with custom fields displayed on a page (2 posts)

  1. Mark Shirley
    Member
    Posted 1 year ago #

    I have custom posts named movie they have custom field content and taxonomies (I've done this). Does anyone have code to display these posts on a page. ie - it could be a page called latest Movies and it would call the latest movies based on an actor called Paul Smith and a Actress called Jane Brown. My problem always seems to be the data from the custom fields doesnt show.

    A link to a good tutorial would be fine if nobody has code.

  2. Mark Shirley
    Member
    Posted 1 year ago #

    I've nearly got what i need with code below I just need to be able to add the taxonomies of actor peter smith and actresss jane brown when calling movies.

    <?php
    $postslist = get_posts('numberposts=4&order=DESC&orderby=date&post_type=movies');
    foreach ($postslist as $post) :
    setup_postdata($post);
    ?>
    <div id="post-wrapper">
    <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
    <h5>Price</h5> £<?php echo get_post_meta($post->ID, 'price', true); ?>
    <div id="copy-1"><?php the_field('copy_1'); ?></div>
    </div><!-- #post-wrapper -->
    <?php endforeach; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic