Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function be_display_posts_read_more( $output, $atts, $image, $title, $date, $excerpt, $inner_wrapper, $content, $class ) {
- // First check if an excerpt is included by looking at the shortcode $atts
- if ( $atts['include_excerpt'] )
- // Now let's rebuild the excerpt to include read more
- $excerpt = '<span class="excerpt">' . get_the_excerpt() . '<br /><br /><a class="more-link" href="' . get_permalink() . '">Read the full testimonial »</a></span>';
- else $excerpt = '';
- // Fetch the custom field values and store them in variables
- $name = esc_html( get_post_meta( get_the_ID(), 'name', true ) );
- $title = esc_html( get_post_meta( get_the_ID(), 'title', true ) );
- $organization = esc_html( get_post_meta( get_the_ID(), 'organization', true ) );
- if ( $name || $title || $organization ) {
- $testimonial_meta = '<div class="testimonial-meta">';
- }
- if ( $name ) {
- $testimonial_meta .= '<p>Name: ' . $name . '</p>';
- }
- if ( $title ) {
- $testimonial_meta .= '<p>Title: ' . $title . '</p>';
- }
- if ( $organization ) {
- $testimonial_meta .= '<p>Organization: ' . $organization . '</p>';
- }
- if ( $name || $title || $organization ) {
- $testimonial_meta .= '</div>';
- }
- // Now let's rebuild the output. Only the excerpt changed so we're using the original $image, $title, and $date
- $output = '<' . $inner_wrapper . ' class="' . implode( ' ', $class ) . '">' . $image . $title . $date . $excerpt . $content . $testimonial_meta . '</' . $inner_wrapper . '>';
- // Finally we'll return the modified output
- return $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement