• Resolved recoverysquared

    (@recoverysquared)


    When I utilize the Read More functionality and click on the link it takes me to the post using the single.php.

    I am utilizing the Genesis these.

    I want the testimonial to show like it does in the view with the quote and image and other formatting.

    When I click the Read More there is no image, no quote and it has my name, as the poster.

    I am tr4ying to make it look exactly the same, but with the extended text. Can you provide me instructions on how to modify this to get the desired effect?

    I am a web developer, new to wp, but can figure it out…

    Thank,

    Steve

    https://ww.wp.xz.cn/plugins/strong-testimonials/

Viewing 6 replies - 1 through 6 (of 6 total)
  • anonymized-13171256

    (@anonymized-13171256)

    Hi Steve,

    How many testimonials do you expect to have?

    I ask because there is a simpler way to accomplish this if you don’t have a lot of testimonials.

    Thread Starter recoverysquared

    (@recoverysquared)

    Chris,

    Right now I have 6 or so, but it will be in the hundreds in the coming months and years.

    Steve

    anonymized-13171256

    (@anonymized-13171256)

    In Genesis, we have to do everything with hooks and filters. Here’s enough to get you started.

    Functions

    Add these to your functions.php file. (The purist in me wants to recommend a separate file for these functions but I’m not sure which Genesis hook to hang it on.)

    /**
     * Add custom fields from Strong Testimonials to single testimonial posts.
     *
     * @param $content
     *
     * @return mixed
     */
    function genesis_child_content_filter( $content ) {
    	if ( is_singular( 'wpm-testimonial' ) ) {
    		$content .= '<div class="testimonial-client">';
    		$content .= '<div class="testimonial-name">' . wpmtst_get_field( 'client_name' ) . '</div>';
    		$content .= '<div class="testimonial-company"><a href="' . wpmtst_get_field( 'company_website' ) . '" target="_blank">' . wpmtst_get_field( 'company_name' ) . '</a></div>';
    		$content .= '</div>';
    	}
    
    	return $content;
    }
    add_filter( 'the_content', 'genesis_child_content_filter' );

    Since the testimonial view settings are not available at this point, you will have to hardcode the custom field names and CSS classes. Adjust accordingly.

    /**
     * Remove the post info line on single testimonial posts.
     *
     * @param $post_info
     *
     * @return string
     */
    function genesis_child_post_info( $post_info ) {
    	if ( is_singular( 'wpm-testimonial' ) ) {
    		return '';
    	}
    
    	return $post_info;
    }
    add_filter( 'genesis_post_info', 'genesis_child_post_info' );
    /**
     * Add the featured image to single testimonial posts.
     */
    function genesis_child_featured_image() {
    	if ( is_singular( 'wpm-testimonial' ) ) {
    		the_post_thumbnail( 'post-image' );
    	}
    }
    add_action( 'genesis_entry_content', 'genesis_child_featured_image', 8 );

    Style

    You will have to copy the CSS from the plugin template to your theme. For example, the default template stylesheet is /plugins/strong-testimonials/templates/default/content.css. Look at the Base, Template, and Responsive sections. You will need to remove each occurrence of .strong-view.default.

    You can either add the CSS to your main stylesheet or create a separate stylesheet. I recommend the latter for easier editing and portability. For example, create a stylesheet named wpm-testimonial.css and load it like this:

    function genesis_child_enqueue_testimonial_style() {
    	if ( is_singular( 'wpm-testimonial' ) ) {
    		wp_enqueue_style( 'single-testimonial-style', get_stylesheet_directory_uri() . '/wpm-testimonial.css' );
    	}
    }
    add_action( 'wp_enqueue_scripts', 'genesis_child_enqueue_testimonial_style' );

    If you add it to your main stylesheet instead, you may want to maintain the high specificity by replacing each occurrence of .strong-view.default with .wpm-testimonial which is the class name automatically added to the <article> element.

    Thread Starter recoverysquared

    (@recoverysquared)

    Thank you for the detailed response!!! Took me a bit to try and get it working…

    I am getting an error on the following line:

    $content .= ‘<div class=”testimonial-client”>’;

    I wanted to try and get it working before I broke it up into different files, but wanted to make as simple as possible. So everything is in functions.php and styles.css.

    Here is the error:

    Fatal error: Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of is_singular(). in /home/content/p3pnexwpnas07_data03/08/2841408/html/wp-content/themes/minimum-pro/functions.php on line 256

    I might be missing something easy because I am a dev, but not a wp or php dev:)

    Thanks for your assistence.

    anonymized-13171256

    (@anonymized-13171256)

    Odd. I tested it on my server before posting.

    What version of PHP are you on? Here’s a plugin to get that info, if you need:
    https://ww.wp.xz.cn/plugins/server-info/

    Please post line 256 which should contain is_singular. Or open a support ticket at wpmission.com/submit-ticket and attach your functions.php as functions.txt.

    Thread Starter recoverysquared

    (@recoverysquared)

    I think it might be another plugin not working with the changes I did. Not necessarily your code. I contact you through your site these customizations.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Read More’ is closed to new replies.