• archive-lp-testimonials.php

    <?php
    
    /**
     * Template Name: Testimonial Archives
     * Description: Used as a page template to show page contents, followed by a loop through a CPT archive
     */
    
    remove_action ('genesis_loop', 'genesis_do_loop'); // Remove the standard loop
    add_action( 'genesis_loop', 'custom_do_grid_loop' ); // Add custom loop
    
    function custom_do_grid_loop() {  
    
    	// Intro Text (from page content)
    	echo '<div class="page hentry entry">';
    	echo '<h1 class="entry-title"> Recommendations </h1>';
    	echo '<div class="entry-content">' . get_the_content() ;
    
    	$args = array(
    		'post_type' => 'lp-testimonials', // enter your custom post type
    		'orderby' => 'menu_order',
    		'order' => 'ASC',
    		'posts_per_page'=> '12',  // overrides posts per page in theme settings
    	);
    	$loop = new WP_Query( $args );
    	if( $loop->have_posts() ):
    
    		while( $loop->have_posts() ): $loop->the_post(); global $post;
    
    		echo '<div id="testimonials"><i class="fa fa-quote-left"></i>';
    			echo '<div class="testimonial">';
    			echo '<blockquote>' . get_the_content() . '</blockquote>';
    			echo '</div>';
    			$items = get_post_meta( get_the_ID(), 'testimonial-details', true );
    			foreach ( $items as $item) :
       				if(!empty($item))
       				echo '<p class="client">'.$item.'</cite>';
    			endforeach;
    		echo '</div>';
    
    		endwhile;
    
    	endif;
    }
    
    /** Remove Post Info */
    remove_action('genesis_before_post_content','genesis_post_info');
    remove_action('genesis_after_post_content','genesis_post_meta');
    
    genesis();

    https://www.ads-software.com/plugins/genesis-testimonials-cpt/

  • The topic ‘Simply put this code and rename files as’ is closed to new replies.