Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Displaying Child Custom Field Types on Parent Page

$
0
0

Hi,

I have the following code,

	<?php 

	    // Get the page's children
	    $children = get_pages("child_of=" . $post->ID);
	
	    if (!empty($children)) { //check if there are any children pages.
	
	    //If there are....
	        foreach($children as $child) {
	
				$title = get_the_title($child->ID);
				$address =  types_render_field("address", array("raw"=>"true","separator"=>";"));
				$telephone =  types_render_field("telephone", array("raw"=>"true","separator"=>";"));
				$proGolfer =  types_render_field("pro-golfer", array("raw"=>"true","separator"=>";"));
				$contactSecretary =  types_render_field("contact-secretary", array("raw"=>"true","separator"=>";"));
				$website =  types_render_field("website", array("raw"=>"true","separator"=>";"));
				$email =  types_render_field("email", array("raw"=>"true","separator"=>";"));
				$previewImage =  types_render_field("preview-image", array("raw"=>"true","separator"=>";"));
				$facilities =  types_render_field("facilities", array("raw"=>"true","separator"=>";"));


				echo "<table><tr>";
				echo "<td colspan='2'>".$title."</td>";
				echo "</tr><tr><td><table><tr>";
				echo "<td colspan='2'>".$address."</td>";
				echo "</tr><tr><td>Pro Golfer:</td>";
				echo "<td>".$proGolfer."</td>";
				echo "</tr><tr>";
				echo "<td>Secretary:</td>";
				echo "<td>".$contactSecretary."</td>";
				echo "</tr><tr><td>Clubhouse:</td>";
				echo "<td>".$telephone."</td>";
				echo "</tr><tr><td colspan='2'><strong>Web:</strong> ";
				echo "<a href='".$website."'>".$website."</a></td>";
				echo "</tr><tr><td colspan='2'><strong>Email:</strong> ";
				echo "<a href='mailto:".$email."'>".$email."</a></td>";
				echo "</tr></table></td>";
				echo "<td>".$previewImage."</td>";
				echo "</tr><tr colspan='2'>";
				echo "<td>".$facilities."</td>";
				echo "</tr></table>";
				echo "<hr />";

	        }
	
			//If there aren't any child pages...
	    } else {
	
	    	//Blank space
	    }
	    
	?> 

The titles are displaying fine, but i cant pull through the custom fields i created, any help would be great.


Viewing all articles
Browse latest Browse all 20145

Trending Articles