WordPress.org

Ready to get started?Download WordPress

Forums

TBTestimonials
[resolved] Add company name and url to page template (5 posts)

  1. tanjadebie
    Member
    Posted 1 year ago #

    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 fields:

    tbtestimonial_company_url
    tbtestimonial_company

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

    also tried TRUE.

    <?php the_meta(); ?>
    does output:

    tbtestimonial_company_url: http://www**************
    tbtestimonial_company: *******************

    Do you have a suggestion for me?

    thanks (and best wishes)
    Tanja

    http://wordpress.org/extend/plugins/tb-testimonials/

  2. Travis Ballard
    Member
    Plugin Author

    Posted 1 year ago #

    My guess is that $post->ID is probably null so it's not working correctly. It should be within the loop that you're fwtching the meta. Otherwise you will need to bring $post into the current scope in order to access it. Can you pastebin your template?

  3. Travis Ballard
    Member
    Plugin Author

    Posted 1 year ago #

    Marking this as resolved. If it isn't, please reopen it.

  4. comparebest
    Member
    Posted 12 months ago #

    I am having the same problem, here is my code from testimonial.php:

    <?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? :)

  5. comparebest
    Member
    Posted 11 months ago #

    Ok I've started a new thread about this since this one is already marked as resolved and can be overlooked :)

    New thread is here.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.