• Resolved Charles Grimes

    (@cagrimes)


    I created a custom field, “City” and named as “city_name”. When I add the [strong form] code, the form displays all fields including city. However when I view the testimonials page, city is not displayed. Checking the testimonials in wp admin pages, the city_name field is present and the city is populated.

    Code:

    [strong per_page="5" nav="before,after" title]
    [client]
    [field name="client_name"]
    [field name="city_name" class="city"]
    [/client]
     [/strong]

    What am I missing?

    Thanks! / Charles

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

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

    (@cdillon27)

    The shortcode looks correct. Any caching? Is the site live that I can see it?

    Thread Starter Charles Grimes

    (@cagrimes)

    Chris

    It should be up at https://www.iass.co/dbhomes

    No, no caching.

    Plugin Contributor Chris Dillon

    (@cdillon27)

    That link is not working for me.

    Does the field appear in the custom fields in the post editor, like in this screenshot?

    Thread Starter Charles Grimes

    (@cagrimes)

    Chris … nothing is easy

    Here is a working link: https://ec2-52-6-192-97.compute-1.amazonaws.com/dianes-reviews/
    (not pretty, but it is a devel site)

    The field appears just as it does in your screenshot:

    Plugin Contributor Chris Dillon

    (@cdillon27)

    I see now. You’re using the theme template. You must add your new field to the client section, like:

    <div class="city"><?php wpmtst_field( 'city_name' ); ?></div>

    or use the function that processes the child shortcodes:

    <?php wpmtst_field( 'client', array( 'content' => $shortcode_content ) ); ?>

    Not many people use the template files yet so it’s not on my troubleshooting radar.

    Thread Starter Charles Grimes

    (@cagrimes)

    If there is a better way… I admit, I’m moving from static to WordPress. I like it, but there is a learning curve ??

    Plugin Contributor Chris Dillon

    (@cdillon27)

    Seems like I can’t turn around without having to learn something new ??

    The template file is really only useful if you want to change the HTML structure, like moving the thumbnail after the content, or if you need to add other template functions from WordPress or another plugin.

    Otherwise, try it without the template file and see how far you can get with the shortcode and CSS overrides.

    I’ve been meaning to write a template tutorial but the next version will likely have a new base template that will be easier to use and adapt.

    Thread Starter Charles Grimes

    (@cagrimes)

    Chris

    I feel like I’m wearing out my welcome with your time. I’m using the Divi “theme” (it’s more like a framework) and created the page for testimonials/reviews using he Divi Builder. There are 2 code modules.
    1 on the side which is the submission form
    2 takes up 2/3 of the page and is a has the shortcode.
    That’s all I did..nothing else. Essentially, its a blank page with the header image and 2 blocks of code and one of text (the disclaimer below the form)

    The form retains all the info, but doesn’t display the city (custom field). Also, I added [strong read_more page=”all-testimonials” /] but it links for the page, not the post, which is what I was actually looking for it to do.

    The php function would go in function php for the child theme?

    Thanks for your time…much appreciated.

    Plugin Contributor Chris Dillon

    (@cdillon27)

    It’s no problem, Charles. This helps me too. Sometimes it’s even my fault.

    In viewing the source code, I see
    <!-- Strong Testimonials default theme template -->
    which is in the template file provided by the plugin to be copied into the theme for customization. The plugin uses a different default template. Are you sure that testimonials.php was not copied into the (child) theme?

    Thread Starter Charles Grimes

    (@cagrimes)

    ah-ha

    testimonials.php is in the child theme. I added the <div class=”city”><?php wpmtst_field( ‘city_name’ ); ?></div> to the script and that did the trick.

    So, can I modify that script to fix the “read more” for the individual posts (to go to the full testimonial page?)?

    Learning experience

    Plugin Contributor Chris Dillon

    (@cdillon27)

    Yes, but now you don’t need the plugin to handle that. Just add a link:

    <div class="readmore">
      <a href="<?php echo get_permalink( your page ID here ); ?>">Read more cool stuff</a>
    </div>

    or

    <div class="readmore">
      <a href="your absolute URL here">Read more cool stuff</a>
    </div>

    Thread Starter Charles Grimes

    (@cagrimes)

    Chris

    I changed the code to this:

    [strong per_page="5" nav="before,after" title thumbnail length="150" more_post]
    [client]
    [field name="client_name" class="name"]
    [field name="city_name" class="city"]
    [/client]
    [/strong]

    You can view the result at https://ec2-52-6-192-97.compute-1.amazonaws.com/dianes-reviews/

    While the city is solved, I’m still stumped on viewing the remainder of the individual posts, a couple are several paragraphs long.

    Also, I just tried changing the value of “length” to 300 which had no effect on the post excerpt displayed. No, I don’t have anything in the excerpt box on the back end.

    Unless I”m missing something, the code in your last reply would only direct to a single specific post or page, but not allow viewing the entire post for any post that is truncated.

    New question, if there is no image directly associated with the post, can I specify a featured image (i.e., a thumbnail of the post author or a site logo if their is not a photo of the author).

    Thanks in advance.

    Charles

    Plugin Contributor Chris Dillon

    (@cdillon27)

    I have a simpler approach for template files in the works, but until then…

    Some functions in the theme template override their shortcode option counterparts, “length” being one of them. Its purpose is to give you more control. You will have to change the “char_limit” value in this line:

    <?php wpmtst_field( 'truncated', array( 'char_limit' => 100 ) ); ?>

    I misunderstood your target. The get_permalink function also works for posts in the testimonial loop.

    <div class="readmore"><a href="<?php echo get_permalink( $post ); ?>">Read more</a></div>

    To show something instead of a featured image:

    <?php if ( $thumbnail && has_post_thumbnail( $post->ID ) ) : ?>
    <div class="photo"><?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?></div>
    <?php else : ?>
    <?php /* maybe get_avatar() if they're a site user? */ ?>
    <?php endif; ?>

    Thread Starter Charles Grimes

    (@cagrimes)

    Awesome…I’ll add these and let you know how it turns out…

    Thanks…you are incredibly generous and responsive!

    Charles

    Thread Starter Charles Grimes

    (@cagrimes)

    Aargh…

    I fixed the character limit (now 200) and Read More points to the post. I still have the ugly quote marks vs the featured image (which should be the only image available).

    Okay, here is testimonials.php

    <div class="strong-container <?php echo $container_class_list; ?>">
    	<div class="strong-content <?php echo $content_class_list; ?>">
    		<?php while ( $query->have_posts() ) : $query->the_post(); ?>
    		<div class="<?php echo $post_class_list; ?> post-<?php echo the_ID(); ?>">
    			<div class="inner">
    				<h3 class="heading" style="font-style: strong; italic;"><?php the_title(); ?></h3>
    				<?php /* The Content Block */ ?>
    				<div class="content">
    					<?php /* Thumbnail */ ?>
    					<?php /* Removed in favor of if/then/else below */ ?>
    					<?php /* See original testimonials.php in plugins */ ?>
    
    					<?php if ( $thumbnail && has_post_thumbnail( $post->ID ) ) : ?>
    					<div class="photo"><?php echo get_the_post_thumbnail( $post->ID, 'thumbnail' ); ?></div>
    					<?php else : ?>
    					<?php /* maybe get_avatar() if they're a site user? */ ?>
    					<?php endif; ?>
    					<?php /* Sets review exerpt to 200 characters */ ?>
    					<?php wpmtst_field( 'truncated', array( 'char_limit' => 200 ) ); ?>
    				</div>
    				<div class="readmore"><a href="<?php echo get_permalink( $post ); ?>">Read more</a></div>
    				<?php /* The Client Block */ ?>
    				<div class="client">
    					<?php /* Custom Fields */ ?>
    					<div class="name"><?php wpmtst_field( 'client_name' ); ?></div>
    					<div class="company"><a href="<?php wpmtst_field( 'company_website' ); ?>" target="_blank"><?php wpmtst_field( 'company_name'); ?></a></div>
    					<div class="city"><?php wpmtst_field( 'city_name' ); ?></div>
    					<?php /* OR */ ?>
    					<?php /* Child Shortcodes Within [strong] Shortcode */ ?>
    					<?php //wpmtst_field( 'client', array( 'content' => $shortcode_content ) ); ?>
    				</div>
    				<div class="clear"></div>
    			</div>
    		</div>
    		<?php endwhile; ?>
    	</div>

    Here is the strong code:

    [strong per_page="5" nav="before,after" title thumbnail length="300" more_post] [client]
    [field name="client_name" class="name"]
    [field name="city_name" class="city"]
    [/client] [/strong]

    functions.php is not modified in either parent or child them (Divi by Elegant Themes)

    I know there is a nice brick wall around here someplace…

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘Custom field name not appearing in (strong) testimonial’ is closed to new replies.