• Resolved Gecko

    (@gecko1952)


    A client wanted to display the Star rating on the listed reviews, not just the name and review excerpt but the full review and the star rating as well. So I came up with a fix that accomplishes this, it does loose the individual review display page but it’s not needed as each listing is now complete.

    Copy the parent theme’s archive.php file to the child theme’s directory. Now edit the archive.php file in the child theme folder adding the following code. Note the comment lines // about placement within the theme.

    //theme_before_content
    
    <?php
    //custom reviews display for Cosmick Star Rating plugin
    
      if(is_archive( 'reviews' )) {
       $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
    	$args = array(
    	'post_type' => 'reviews',
      	'posts_per_page' => 5,
      	'paged'          => $paged );
    
       $REVIEW_QUERY = new WP_Query( $args );
    
    	if ($REVIEW_QUERY->have_posts()) :
    		while ($REVIEW_QUERY->have_posts()) :
    		$REVIEW_QUERY->the_post();
    		?>
    		<div class="review-container">
    		<div class="review-heading">
    		<h3 class="review-title"><?php the_title(); ?></h3>
    		</div>
    		<div class="review-body">
    		<p><?php the_content(); ?></p>
    		<hr align="center" width="50%" color="#136986" />
    		<p>?</p>
    		</div>
    		</div>
    		<?php
    		endwhile;
    		endif;
    		?>
    		<div class="prev-next">
                    <?php posts_nav_link( ' ? previous page', 'next page ?' );
    		?>
    		</div>
    		<?php
    		csr_add_rating(); 
    
    		wp_reset_postdata();
    		}else{
    		//theme_content
    		}
    		?>
    		//theme_after_content

    Hope this helps someone else ??

    https://www.ads-software.com/plugins/cosmick-star-rating/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘List display with Star rating’ is closed to new replies.