File: /www/wwwroot/biographybirthday.com/wp-content/themes/bio/parts/content-facts.php
<table class="table table-striped facts" style="margin-top:10px;">
<tbody>
<?php
$fullName = metaField('bio_first_name').' '.metaField('bio_last_name');
if($fullName == ''){
$fullName = get_the_title();
}
?>
<tr>
<th>Full Name: </th>
<td><?php echo $fullName; ?></td>
</tr>
<?php
$dob = metaField('bio_dob');
if(!empty($dob)){
list($birthyear, $birthmonth, $birthday) = explode('-',$dob);
}
if(!empty($dob) ) {
?>
<tr>
<th>Born Date: </th>
<td><?php echo date('d M, Y',strtotime($dob)); ?></td>
</tr>
<tr>
<th>Age: </th>
<td><?php echo calculateAge($dob); ?></td>
</tr>
<tr>
<th>Horoscope: </th>
<td><?php echo metaField('bio_horoscope'); ?></td>
</tr>
<tr>
<th>Lucky Number: </th>
<td><?php echo calculateLuckyNumber($birthyear, $birthmonth, $birthday); ?></td>
</tr>
<tr>
<th>Lucky Stone: </th>
<td><?php echo luckyStone($birthmonth, $birthday); ?></td>
</tr>
<tr>
<th>Lucky Color: </th>
<td><?php echo luckyColor($birthmonth, $birthday); ?></td>
</tr>
<tr>
<th>Best Match for Marriage: </th>
<td><?php echo bestMatches($birthmonth, $birthday); ?></td>
</tr>
<?php } ?>
<?php $dod = metaField('bio_dod'); ?>
<?php if(!empty($dod)):?>
<tr>
<th>Death Date: </th>
<td><?php echo date('F j, Y', strtotime($dod) ); ?></td>
</tr>
<?php endif;?>
<?php $gender = metaField('bio_gender');
if($gender) {
?>
<tr>
<th>Gender: </th>
<td><?php echo $gender; ?></td>
</tr>
<?php } ?>
<?php $profession = metaField('bio_profession');
if($profession) {
?>
<tr>
<th>Profession: </th>
<td><?php echo $profession;?></td>
<!-- <td>--><?php //echo '<a href="'. get_home_url() .'/filter/?profession='.str_replace(' ','+',trim($profession)).'">' . $profession . '</a>'; ?><!--</td>-->
</tr>
<?php } ?>
<?php $country = metaField('bio_country');
if($country) {
?>
<tr>
<th>Country: </th>
<td><?php echo $country; ?></td>
</tr>
<?php } ?>
<?php $saying = metaField('bio_quotes');
if($saying) {
?>
<tr>
<th>Saying: </th>
<td><?php echo $saying;?></td>
</tr>
<?php } ?>
<?php $height = metaField('bio_height');
if($height) {
?>
<tr>
<th>Height: </th>
<td>
<?php $display_height = '';
$filter_url = '';
if(is_numeric($height)){
$feet = floor($height/12);
$inches = ($height%12);
$display_height = $feet .' feet '.$inches.' inches ('.sprintf('%.2f',$height*0.0254).'m)';
$filter_url = $height;
echo $display_height;
}else{
$display_height = $height;
echo $display_height;
}
?>
</td>
</tr>
<?php } ?>
<?php $weight = metaField('bio_weight');
if($weight) {
?>
<tr>
<th>Weight: </th>
<td><?php echo $weight;?> Kg</td>
</tr>
<?php } ?>
<?php $maritalstatus = metaField('bio_maritalstatus');
if($maritalstatus && $maritalstatus != 'not_identified') {
?>
<tr>
<th>Marital Status: </th>
<td><?php echo $maritalstatus;?></td>
</tr>
<?php } ?>
<?php $married_date = metaField('bio_married_date'); ?>
<?php if(!empty($married_date)):?>
<tr>
<th>Married Date: </th>
<td><?php echo date('F j, Y', strtotime($married_date) ); ?></td>
</tr>
<?php endif;?>
<?php $facts = array(
'husband'=>'Husband',
'wife'=>'Wife',
'dating' => 'Dating',
'break-up' => 'Break Up',
'divorce' => 'Divorce',
'net-worth' => 'Net Worth',
'salary' => 'Salary',
'eye-color' => 'Eye Color',
'hair-color' => 'Hair Color',
'body-size' => 'Body Size',
'birth-place' => 'Birth Place',
'status' => 'Status',
'nationality' => 'Nationality',
'ethnicity' => 'Ethnicity',
'religion' => 'Religion',
'education' => 'Education',
'father'=>'Father',
'mother' => 'Mother',
'sibling' => 'Siblings',
'kids' => 'Kids'
);
foreach($facts as $key=>$fact){
$fact_val = metaField('bio_fact_'.$key);
if($fact_val){
if($key == 'net-worth'){
echo '<tr><th>'.$fact.'</th><td><a href="'. get_home_url() .'/networth/'.str_replace(' ','+',trim($fact_val)).'">' . $fact_val . '</a>'.'</td></tr>';
}else{
echo '<tr><th>'.$fact.'</th><td>'.$fact_val.'</td>';
}
}
}
$social_medias = array(
'facebook' => 'Facebook',
'twitter' => 'Twitter',
// 'google' => 'Google+',
'youtube' =>'Youtube',
'instagram' => 'Instagram',
// 'vevo' => 'Vevo',
// 'itunes' => 'iTunes',
'personal-web' => 'Personal Web',
'imdb' => 'IMDB',
'wiki' => 'Wiki'
);
foreach($social_medias as $key=>$social){
$fact_val = metaField('bio_social_'.$key);
if($fact_val){
echo '<tr><th>'.$social.'</th><td><a href="'.$fact_val.'" target="_blank"> '.$fullName.' '.$social.'</a></td>';
}
}
?>
<tr>
<td colspan="2" style="text-align:center;">
<a href="#" class="viewmore">View more / View less Facts of <?php echo $fullName;?></a>
</td>
</tr>
</tbody>
</table>
<style>
.table-striped tr th{text-align: left;}
/*.entry-content .table-striped th{*/
/*background: none;*/
/*}*/
/*.table-striped tbody tr:nth-of-type(odd){*/
/*background-color: rgba(0,0,0,.05);*/
/*}*/
/*.table-striped tbody td,.table-striped tbody th{*/
/*font-size: .8em;*/
/*}*/
/* SHOW LATER */
.entry-content .table-striped a{border-bottom:none;}
.table-striped tr:nth-child(n+6){
display: none;
}
.table-striped tr:last-child{
display: table-row;
}
</style>
<script>
$ = jQuery;
$(function(){
var tablestatus = 1;
$('body').on('click','.viewmore',function(){
$(this).removeClass('viewmore').addClass('viewless');
$('.table-striped tr').show();
return false;
});
$('body').on('click', '.viewless',function(){
$(this).removeClass('viewless').addClass('viewmore');
$('.table-striped tr:nth-child(n+6)').hide();
$('.table-striped tr:last-child').attr('style','display:table-row');
return false;
});
});
</script>
<style>
</style>