• Resolved sitebuildernow

    (@sitebuildernow)


    Hi Chris, I continue to love this plugin but I have a challenge I have yet to resolve. I want to make it easy for a user to return to the “all testimonials” page once they have clicked to view a single testimonial.

    You can get an idea of what I’m trying to say by going to https://clauspaws.com/from-our-clients/, click on “More”. That takes you to the full version of that testimonial – but there is no “back to all testimonials” link … I cannot figure out how to add that link to individual/single post views. Am I blind or ???

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Chris Dillon

    (@cdillon27)

    It’s on the To-Do list. 🙂

    Here’s a quick fix. Add this to your theme’s functions.php or create an mu-plugin:

    /**
     * Add link back to testimonials page.
     * 
     * @param $content
     *
     * @return string
     */
    function my_link_back( $content ) {
    	if ( is_singular( 'wpm-testimonial' ) ) {
    		ob_start();
    		?>
    		<p>
    			<a href="javascript:history.go(-1)" title="Return to the previous page">&laquo; Go back</a>
    		</p>
    		<?php
    		$content .= ob_get_clean();
    	}
    
    	return $content;
    }
    add_filter( 'the_content', 'my_link_back', 20 );

    Also, if you want to add your custom fields to the single testimonial too, create a new view and select Single Template mode.

    Thread Starter sitebuildernow

    (@sitebuildernow)

    Chris, thank you as always for the quick response and solution – works great!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Return to All Testimonials page’ is closed to new replies.