0

I've tried checking for a similar question but couldn't find one. If possible please link me to this as I might be creating a duplicate. Anyways..

I am using a basic testimonial plugin (Clean Testimonials) and wish to create a custom template which it allows.

The only things I like to add are the the_client() and the_website() functions. But the the_website() function isn't displaying?

<div class="su-posts su-posts-default-loop">
<?php
    // Posts are found
    if ( $posts->have_posts() ) {
        while ( $posts->have_posts() ) :
            $posts->the_post();
            global $post;
            ?>

            <div id="su-post-<?php the_ID(); ?>" class="su-post">
                <?php if ( has_post_thumbnail() ) : ?>
                    <a class="su-post-thumbnail"><?php the_post_thumbnail(); ?></a>
                <?php endif; ?>
                <div class="su-post-content">
                    <p><?php the_content(); ?></p>
                    <p style="color:blue;"><?php echo the_client (); ?>, <?php echo the_website (); ?></p>
                </div>

            </div>

            <?php
        endwhile;
    }
    // Posts not found
    else {
        echo '<h4>' . __( 'Posts not found', 'shortcodes-ultimate' ) . '</h4>';
    }
?>

Below is the functions.php for the plugin:

<?php
/*
Helper functions for Clean Testimonials
*/

function the_client () {

    global $post;

    return get_post_meta( $post->ID, 'testimonial_client_name', true );

}

function get_the_client ( $testimonial_id ) {

    return get_post_meta( $testimonial_id, 'testimonial_client_name', true );

}

function the_company () {

    global $post;

    return get_post_meta( $post->ID, 'testimonial_client_company', true );

}

function get_the_company ( $testimonial_id ) {

    return get_post_meta( $testimonial_id, 'testimonial_client_company', true );

}

function the_email () {

    global $post;

    return get_post_meta( $post->ID, 'testimonial_client_email', true );

}

function get_the_email ( $testimonial_id ) {

    return get_post_meta( $testimonial_id, 'testimonial_client_email', true );

}

function the_website () {

    global $post;

    return get_post_meta( $post->ID, 'testimonial_client_website', true );

}

function get_the_website ( $testimonial_id ) {

    return get_post_meta( $testimonial_id, 'testimonial_client_website', true );

}

function testimonial_has_permission( $testimonial_id ) {

    return get_post_meta( $testimonial_id, 'testimonial_client_permission', true ) == 'yes';

}

?>

Kind regards,

2
  • Can you write coding issue? what error are you facing? Feb 29, 2016 at 11:24
  • Hi @DevendraSharma thank you for the reply. I am facing coding issue that the the_website() function is not displaying, but facing no errors so meaning that the function is called properly? Is there a similar topic to this or a quick solution? Kind regards,
    – sumnermic
    Feb 29, 2016 at 11:31

1 Answer 1

0

You can use below code.

get_the_client(get_the_ID());
get_the_company(get_the_ID());
get_the_website(get_the_ID());
4
  • Hi @DevendraSharma for some reason only the client is still appearing. I will see if the function has conflicted with another plugin. For the meantime, is there a way to say that 'I want this function from this specific plugin'?
    – sumnermic
    Feb 29, 2016 at 12:14
  • Okay . also you use like this. get_post_meta( $post->ID, 'testimonial_client_website', true ); Feb 29, 2016 at 12:18
  • It still isn't able to display itself unfortunately. Could there more workarounds?
    – sumnermic
    Feb 29, 2016 at 14:15
  • are you sure testimonial_client_website is the correct meta_key? have you checked the plugin or your wp_postmeta database table to verify this?
    – majick
    Feb 29, 2016 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.