Hey everyone,
I’ve been trying to modify the layout of the detail-page fields to achieve what is in the screenshot attached. I’ve realized that I have to extract each field manually and place them in my own html. I’ve done this using the below code (Ignore the HTML display part it’s not done):
// ### BEGIN CUSTOM DETAILS ### //
add_action( 'geodir_details_main_content', 'custom_details', 23 );
function custom_details() {
global $post;
global $wp_query;
$postid = $wp_query->post->ID;
$current_posttype = geodir_get_current_posttype();
$myauthor = get_the_author();
$myauthorlink = get_author_posts_url( get_the_author_meta( 'ID' ) ).'?post_type='.$current_posttype;
// echo '<p class="clearfix">Listed by <a href="' .$myauthorlink . '">' . $myauthor . '</a></p>';
$hc_title= geodir_get_post_meta($postid,'post_title',true); //title
$hc_address=geodir_get_post_meta($postid,'post_address',true); //address
$hc_phone=geodir_get_post_meta($postid,'geodir_contact',true); //phone
$hc_email=geodir_get_post_meta($postid,'geodir_email',true); //email
$hc_website=geodir_get_post_meta($postid,'geodir_website',true); //website
$hc_facebook=geodir_get_post_meta($postid,'geodir_facebook',true); //facebook
$hc_twitter=geodir_get_post_meta($postid,'geodir_twitter',true); //facebook
$hc_restaurant_hours=geodir_get_post_meta($postid,'geodir_restaurant_hours',true); //hours
$hc_restaurant_ppp=geodir_get_post_meta($postid,'geodir_restaurant_ppp',true); //price
$hc_restaurant_wheelchair=geodir_get_post_meta($postid,'geodir_restaurant_wheelchair',true); //wheelchair
// echo '<h3>'.$hc_title.'</h3>';
echo '<p class="clearfix">Address: '.$hc_address.'</p>';
echo '<p class="clearfix">Phone: '.$hc_phone.' | Email: '.$customemail.'</p>';
echo '<p class="clearfix"><a href="'.$hc_website.'" target="_blank">Visit Website</a></p>';
echo '<p class="clearfix"><a href="'.$hc_facebook.'" target="_blank">Facebook</a></p>';
echo '<p class="clearfix"><a href="'.$hc_twitter.'" target="_blank">Twitter</a></p>';
echo '<p class="clearfix">Timing: '.$hc_restaurant_hours.'</p>';
echo '<p class="clearfix">Price Per Plate: '.$hc_restaurant_ppp.'</p>';
echo '<p class="clearfix">Wheelchair Accessible?: '.$hc_restaurant_wheelchair.'</p>';
}
// ### END CUSTOM DETAILS ### //
The problem is that ALL these fields are being displayed on all CPTs, but I just want to show the fields for the relevant CPT. For example, the “Price Per Plate” field should show for Restaurants CPT but not for Schools.
How would I go about doing this OR if there is a better way to achieve my screenshot layout, please advise.
Thanks very much,
Shiraz