Skip Navigation

[Resolved] Types field not being rendered in PHP template

This support ticket is created 6 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 4 replies, has 2 voices.

Last updated by davidR-12 6 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#545280

Hi there,

I have a page here:

hidden link

This is a results page for a Geocoding pluign. You can see I have added the word test to the template so new ocntent is displaying. I have also added a types render field code:

types_render_field("expert-price", array("style" => "FIELD_NAME : $ FIELD_VALUE"))

however this does not display. Can you tell me why this might be?

regards,

David

#545352

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

Thank you for contacting our support forum.

Could you send me the exact code of the template that this is on ?

Thanks,
Shane

#545595
<?php
/**
 * Posts locator "clean" search results template file. 
 * 
 * The information on this file will be displayed as the search results.
 * 
 * The function pass 2 args for you to use:
 * $gmw    - the form being used ( array )
 * $post - each post in the loop
 * 
 * You could but It is not recomemnded to edit this file directly as your changes will be overridden on the next update of the plugin.
 * Instead you can copy-paste this template ( the "clean" folder contains this file and the "css" folder ) 
 * into the theme's or child theme's folder of your site and apply your changes from there. 
 * 
 * The template folder will need to be placed under:
 * your-theme's-or-child-theme's-folder/geo-my-wp/posts/search-results/
 * 
 * Once the template folder is in the theme's folder you will be able to choose it when editing the posts locator form.
 * It will show in the "Search results" dropdown menu as "Custom: clean".
 */
?>
<!--  Main results wrapper - wraps the paginations, map and results -->
<div class="gmw-results-wrapper gmw-results-wrapper-<?php echo $gmw['ID']; ?> gmw-pt-results-wrapper">
	
	<?php do_action( 'gmw_search_results_start' , $gmw, $post ); ?>
	
	<!-- results count -->
	<div class="gmw-results-count">
		<span><?php gmw_results_message( $gmw, false ); ?></span>
	</div>
	
	<?php do_action( 'gmw_search_results_before_top_pagination' , $gmw, $post ); ?>
	
	<div class="gmw-pt-pagination-wrapper gmw-pt-top-pagination-wrapper">
		<!--  paginations -->
		<?php gmw_per_page( $gmw, $gmw['total_results'], 'paged' ); ?><?php gmw_pagination( $gmw, 'paged', $gmw['max_pages'] ); ?>
	</div> 
		
	 <!-- GEO my WP Map -->
    <?php 
    if ( $gmw['search_results']['display_map'] == 'results' ) {
        gmw_results_map( $gmw );
    }
    ?>
	
	<div class="clear"></div>
	
	<?php do_action( 'gmw_search_results_before_loop' , $gmw, $post ); ?>
	
	<!--  Results wrapper -->
	<div class="gmw-posts-wrapper">
		
		<!--  this is where wp_query loop begins -->
		<?php while ( $gmw_query->have_posts() ) : $gmw_query->the_post(); ?>
			
			<!--  single results wrapper  -->
			<?php $featured = ( !empty( $post->feature ) ) ? 'gmw-featured-post' : ''; ?>

			<div id="post-<?php the_ID(); ?>" <?php post_class( 'wppl-single-result '.$featured ); ?>>
		
				<?php do_action( 'gmw_search_results_loop_item_start' , $gmw, $post ); ?>
				
				<!-- Title -->
				<div class="wppl-title-holder">
					<h2 class="wppl-h2">
						<a href="<?php echo the_permalink(); ?>"><?php echo $post->post_count; ?>) <?php the_title(); ?></a>
						<span class="radius-dis">(<?php gmw_distance_to_location( $post, $gmw ); ?>)</span>
					</h2>
				</div>
								
				<!--  Thumbnail -->			
				<?php if ( isset( $gmw['search_results']['featured_image']['use'] ) && has_post_thumbnail() ) { ?>
					
					<?php do_action( 'gmw_search_results_before_image' , $gmw, $post ); ?>
				
					<div id="wppl-thumb" class="wppl-thumb">
						<?php the_post_thumbnail( array( $gmw['search_results']['featured_image']['width'], $gmw['search_results']['featured_image']['height'] ) ); ?>
					</div>
				<?php } ?>
				
				<!--  Excerpt -->
				<?php if ( isset( $gmw['search_results']['excerpt']['use'] ) ) { ?>
					
					<?php do_action( 'gmw_search_results_before_excerpt' , $gmw, $post ); ?>
					
					<div class="wppl-excerpt">
						<?php gmw_excerpt( $post, $gmw, $post->post_content, $gmw['search_results']['excerpt']['count'], $gmw['search_results']['excerpt']['more'] ); ?>
					</div>
				<?php } ?>
				                <?php types_render_field( "expert-price", array( ) ) ?>

				<?php do_action( 'gmw_search_results_before_taxonomies' , $gmw, $post ); ?>
				test
                				                <?php 
types_render_field("expert-price", array("style" => "FIELD_NAME : $ FIELD_VALUE"))
    ?>
                
				<!--  taxonomies -->
				<div id="wppl-taxes-wrapper" class="wppl-taxes-wrapper">
					<?php gmw_pt_taxonomies( $gmw, $post ); ?>
				</div>
					
		    	<div class="clear"></div>
		    	
		    	<div class="wppl-info">
		    		
		    		<div class="wppl-info-left">
			    		<?php if ( !empty( $gmw['search_results']['additional_info'] ) ) { ?>
    
					    	<?php do_action( 'gmw_search_results_before_contact_info', $post, $gmw ); ?>
						   	
						   	<div class="contact-info">
								<h3><?php echo $gmw['labels']['search_results']['contact_info']['contact_info']; ?></h3>
					    		<?php gmw_additional_info( $post, $gmw, $gmw['search_results']['additional_info'], $gmw['labels']['search_results']['contact_info'], 'ul' ); ?> 
					    	</div>
					    <?php } ?>	    
		    		</div>
		    		
		    		<?php if ( !empty( $gmw['search_results']['opening_hours'] ) ) { ?>
    
				    	<?php do_action( 'gmw_search_results_before_opening_hours', $post, $gmw ); ?>
					   	
				    	<div class="opening-hours">
				    		<?php gmw_pt_days_hours( $post, $gmw ); ?>
				    	</div>
				    <?php } ?>
					    
		    		<div class="wppl-info-right">
		    			
		    			<!--  Address -->
		    			<div class="wppl-address">
		    				<div class="address-wrapper">
						    	<span class="fa fa-map-marker address-icon"></span>
						    	<span class="wppl-address"><?php gmw_location_address( $post, $gmw ); ?></span>
						    </div>
		    			</div>
		    		
		    			<!--  Driving Distance -->
						<?php if ( isset( $gmw['search_results']['by_driving'] ) ) { ?>
		    				<?php gmw_driving_distance( $post, $gmw, false ); ?>
		    			<?php } ?>
		    			
		    			<!-- Get directions -->	 	
						<?php if ( isset( $gmw['search_results']['get_directions'] ) ) { ?>
							<div class="wppl-get-directions">
		    					<?php gmw_directions_link( $post, $gmw, $gmw['labels']['search_results']['directions'] ); ?>
		    				</div>
		    			<?php } ?>
			    		
		    		</div><!-- info right end -->
		    	
		    	</div> <!-- info end -->
		    
		    	<?php do_action( 'gmw_search_results_loop_item_end' , $gmw, $post ); ?>
		    	
		    </div> <!--  single- wrapper ends -->
		    
		    <div class="clear"></div>     
		  	
		<?php endwhile; ?>
			
		<!--  end of the loop -->
		
	</div> <!--  results wrapper -->    
	
	<?php do_action( 'gmw_search_results_after_loop' , $gmw, $post ); ?>
		
	<?php do_action( 'gmw_search_results_before_bottom_pagination' , $gmw, $post ); ?>
	
	<!--  Pagination -->
	<div class="gmw-pt-pagination-wrapper gmw-pt-bottom-pagination-wrapper">
		<!--  paginations -->
		<?php gmw_per_page( $gmw, $gmw['total_results'], 'paged' ); ?><?php gmw_pagination( $gmw, 'paged', $gmw['max_pages'] ); ?>
	</div> 
	
	<?php do_action( 'gmw_search_results_end' , $gmw, $post ); ?>
	
</div> <!-- output wrapper -->
#545667

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi David,

I see the issue now .

You're going to have to pass the id of current post in the loop into the function. Like this

types_render_field("expert-price", array("style" => "FIELD_NAME : $ FIELD_VALUE","id"=>$post->ID))

Please try this and let me know if it helps.

Thanks,
Shane

#545725

Hi Shane,

Thats perfect thank you.

Regards,

David

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.