• Resolved comparebest

    (@comparebest)


    Hi,

    I’ve made my own testimonial.php and that renders the output-templates useless. I’ve tried many options to echo the input from these custom field:

    tbtestimonial_company

    <?php echo "Organisatie: ".get_post_meta($post->ID,'tbtestimonial_company', 1); ?>

    also tried:

    <?php echo "Organisatie: ".get_post_meta($post->ID,'tbtestimonial_company', true); ?>

    <?php the_meta(); ?>

    does output:

    tbtestimonial_company: *******************

    Do you have a suggestion for me?

    My code is:

    <?php
    /**
     * The Template for displaying a single Testimonial.
     *
     * @package WordPress
     * @subpackage Twenty_Ten
     * @since Twenty Ten 1.0
     */
    
    get_header(); ?>
    <?php get_sidebar('left'); ?>
    		<div id="container">
    			<div id="content" role="main">
    <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<?php
    			if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
     			 the_post_thumbnail(article_large);
    			}
    			?>
    					<h1 class="entry-title"><?php the_title(); ?></h1>
    
    					<div class="entry-content">
    						<?php the_content(__( 'Read More', 'twentyten' ) ); ?>
    						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    					</div><!-- .entry-content -->
    
    			</div><!-- #post-## -->
    
    <?php echo '<p>' . get_post_meta($post->ID, 'tbtestimonial_company', true) . '</p>'; ?>
    <?php endwhile; // end of the loop. ?>
    <div style="width:100%; text-align:center;"><a href="#bttop">Back to top &uarr;</a></div>
    			</div><!-- #content -->
    		</div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    and the part that is not showing:

    <?php echo '<p>' . get_post_meta($post->ID, 'tbtestimonial_company', true) . '</p>'; ?>

    How do I make it work? ??

    https://www.ads-software.com/plugins/tb-testimonials/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Travis Ballard

    (@ansimation)

    Indtead of using $post->ID, trying using get_the_ID() since you’re in the loop. That should fix it I think it look slike it’s not working because $post isn’t in scope and doesn’t contain the correct ID you expect it to.

    Thanks,
    Travis Ballard

    Plugin Author Travis Ballard

    (@ansimation)

    An yyes, using a testimonial.php will render the output templates useless since that is essentially your new output template. If you still want to use them you can use $tbtestimonials->prepare_testimonial(TEMPLATE_NAME); eg: $tbtestimonials->prepare_testimonial('widget'); to display the widget output syntax. This owuld be used within the loop as well.

    while( have_posts() ) { the_post(); echo $tbtestimonials->prepare_testimonial('widget'); }

    Thread Starter comparebest

    (@comparebest)

    Woot, get_the_ID() totally worked, thanks so much Travis!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add company name to page template’ is closed to new replies.