troubleshooting Question

PHP - Wordpress Syntax error

Avatar of drgleockler
drgleocklerFlag for United States of America asked on
PHPWordPress
4 Comments1 Solution525 ViewsLast Modified:
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 :

http://www.carolinebusiness.com/newsite/property-search/
then click the "Search" button.

Thanks!
ASKER CERTIFIED SOLUTION
James Rodgers
Web Applications Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros