WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type UI
[resolved] Add Post excerpt to my WP_query (2 posts)

  1. Mark Shirley
    Member
    Posted 1 year ago #

    Below is code to displat custom post types with custom fields how can i add the post excerpt to it - Thanks

    '
    <?php $loop = new WP_Query( array( 'post_type' => 'movies','actors' => 'peter-smith', 'actress' => 'jane-smith', 'posts_per_page' => 10 ) ); ?>

    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

    <?php the_title( '<h2 class="entry-title">', '</h2>' ); ?>

    <h5>image</h5>"><img src="<?php the_field('image'); ?>" alt="text-here" />
    <?php endwhile; ?>
    '

    http://wordpress.org/extend/plugins/custom-post-type-ui/

  2. Mark Shirley
    Member
    Posted 1 year ago #

    DONE IT

    <?php $loop = new WP_Query( array( 'post_type' => 'movies','actors' => 'peter-smith', 'actress' => 'jane-smith', 'posts_per_page' => 10 ) ); ?>
    <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    
    <?php the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?>
    
    <h5>image</h5><a href="<?php the_permalink(); ?>"><img src="<?php the_field('image'); ?>" alt="text-here" /></a>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic