WordPress.org

Ready to get started?Download WordPress

Forums

HMS Testimonials
[resolved] Category Template (3 posts)

  1. Paxjah
    Member
    Posted 10 months ago #

    Hello again!

    I've been having lots of fun with this plugin :) I'm not having a ny issues, this is more of a feature/advice request.

    I was wondering if the testimonials could be displayed through a category/archive page.

    Would you have any tips or advice for the best way to do accomplish this?

    Thank you for your time and thank you for your plugin!

    http://wordpress.org/plugins/hms-testimonials/

  2. Paxjah
    Member
    Posted 10 months ago #

    Woo! I found how to do it, possibly it won't be the cleanest way, but for others wondering - here is a custom page.php file that I named page-testimonials.php and manipulated the loop:

    <?php
    /**
     * Template Name: Testimonials (faux category)
     *
     * Learn more: http://codex.wordpress.org/Template_Hierarchy
     *
     * @package WordPress
     * @subpackage Twenty_Thirteen
     * @since Twenty Thirteen 1.0
     */
    
    get_header(); ?>
    
    	<div id="primary" class="content-area">
    		<div id="content" class="site-content" role="main">
    
    			<div class="custom-cat">
    
    				<?php if ( have_posts() ) : ?>
    					<header class="archive-header">
    						<h1 class="archive-title"><?php the_title(); ?></h1><!-- .entry-title -->
    					</header><!-- .entry-header -->
    
    					<div class="entry-content">
    						<?php /* The loop */ ?>
    						<?php
    							$args = array( 'post_type' => 'testimonial', 'posts_per_page' => 10 );
    							$loop = new WP_Query( $args );
    
    							while ( $loop->have_posts() ) : $loop->the_post();
    								echo '<article class="custom-cat-post">';
    								echo '<h3 class="custom-cat-title">';
    								the_title();
    								echo '</h3>';
    								echo '<div class="custom-cat-content">';
    								the_content();
    								echo '</div>';
    								echo '</article><!-- .custom-cat-post -->';
    							endwhile; ?>
    
    						<?php twentythirteen_paging_nav(); ?>
    
    					<?php else : ?>
    						<?php get_template_part( 'content', 'none' ); ?>
    					</div><!-- .entry-content -->
    				<?php endif; ?>
    
    			</div>
    
    		</div><!-- #content -->
    	</div><!-- #primary -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Notes:
    ------
    The below is me adding custom containers around the_title() (the post title) and the_content() (the post content), you can remove these or add change them. The same goes for the classes: custom-cat, custom-cat-post, custom-cat-title and custom-cat-content.

    echo '<article class="custom-cat-post">';
    echo '<h3 class="custom-cat-title">';
    the_title();
    echo '</h3>';
    echo '<div class="custom-cat-content">';
    the_content();
    echo '</div>';
    echo '</article><!-- .custom-cat-post -->';
  3. Jeff K
    Member
    Plugin Author

    Posted 10 months ago #

    That shouldn't work. If it does I am not sure why. Did you have another testimonial plugin installed at one time?

    I recommend creating groups in the plugin then individual pages only show those groups. You can use the limit attribute on the shortcode to create paging.

    Jeff

Reply

You must log in to post.

About this Plugin

About this Topic