Title: Types Custom Fields, syntax error
Last modified: August 21, 2016

---

# Types Custom Fields, syntax error

 *  [dannidar](https://wordpress.org/support/users/dannidar/)
 * (@dannidar)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/types-custom-fields-syntax-error/)
 * Hello all,
    I am hoping (begging!) for a little help with my syntax here 😉 I
   am using Types Custom fields and would like the data to display through another
   plugin…I have mostly figured out how to get the data for each field that has 
   been filled in, but am STUCK when it comes to the syntax in this area to insert
   a link if the data exists, and apply a class to it. Here’s what I have so far:
 *     ```
       function ajax_result($arg, $id,$pagenumber){
       		   $apiclass = new ajaxwpqsfclass();
       		  // The Query
       			$query = new WP_Query( $arg );
       			$html ='';
       			// The Loop
       		if ( $query->have_posts() ) {
       			$html .= '<h1>'.__('Search Results :', 'AjWPQSF' ).'</h1>';
       			while ( $query->have_posts() ) {
       				$query->the_post();
       					$html .= '<h2 class="entry-title">'.get_the_title().'</h2>';
       					$html .= '<div class="one_third">';
       					$html .= '<article>'.get_the_post_thumbnail($post_id, 'large').'';
       					$html .= '</div></article>';
       					$html .= '<div class="two_third last">'.get_the_content().'';
       					$html .= '<article>'.types_render_field("address", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("park-location", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("allowable-uses", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("zoning", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("total-size", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("total-acreage", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("max-ceiling-height", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("rail-served", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article>'.types_render_field("pdf-summary", array("output"=>"HTML","show_name"=>"true"));'</article>';
       					$html .= '<article><a class="button small default" href="'.types_render_field("contact-cedc", array("output"=>"raw")).'">'.get_the_title().'</a></article>';
       					$html .= '</div>';
       					$html .= '<div style="clear:both;"></div>';
       					$html .= '<div style="margin-top:40px;margin-bottom:20px" class="demo-sep sep-single"></div>';
   
       			}
   
       			$html .= $apiclass->ajax_pagination($pagenumber,$query->max_num_pages, 4, $id);
       		 } else {
       					$html .= __( '<h2>No Properties Match Your Criteria</h2><br/>←Please search again', 'AjWPQSF' );
       				}
       				/* Restore original Post Data */
       				wp_reset_postdata();
   
       			return $html;
   
       	   }	
   
       	}//end class
       ```
   
 * The problem area is here:
    `$html .= '<article><a class="button small default"
   href="'.types_render_field("contact-cedc", array("output"=>"raw")).'">'.get_the_title().'
   </a></article>';`
 * as you can see…..I am obviously a php idiot, and would GREATLY appreciate any
   help anyone could offer!
 * The desired output would be a button that displays the words “Contact CEDC” (
   which is the field name)which links to the url entered via the custom field “
   contact-cedc” (which is a single line text field), only if that field has data
   in it. (I can change this to a url field if necessary.)
 * PLEASE, any help would be very much appreciated!!!
    Thank you so much! The url
   where you can see the above code in action is here :
 * [ then click the “Search” button.](http://www.carolinebusiness.com/newsite/property-search/)
 * Thanks!

The topic ‘Types Custom Fields, syntax error’ is closed to new replies.

## Tags

 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 0 replies
 * 1 participant
 * Last reply from: [dannidar](https://wordpress.org/support/users/dannidar/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/types-custom-fields-syntax-error/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
