Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes for people link and external link
  • Loading branch information
Calande committed Apr 5, 2016
1 parent 88e85b6 commit d79d2ff
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 33 deletions.
58 changes: 31 additions & 27 deletions inc/people-grid.php
Expand Up @@ -2,32 +2,35 @@
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) { ?>
<div class="row">
<?php
<?php
$person_count=1;
while ( $the_query->have_posts() ) {
$the_query->the_post();


?>







<div class="col-sm-3 personcount-<?php echo $person_count ?>" id="person-<?php echo get_the_id(); ?>">
<div class="person">
<?php

echo '<a href="'. get_the_permalink().'" class="person-permalink">';

<?php
$external_url = get_field('external_url');
if ( $external_url != "" ){
echo '<a href="'. $external_url .'" class="person-permalink" target="_blank">';
}else{
echo '<a href="'. get_the_permalink().'" class="person-permalink">';
}
if (in_array('photo', $information_to_display)) {
echo '<div class="person-image">';
the_post_thumbnail('large');
echo '</div>';
};

if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){
echo '<h4 class="person-name">';
if (in_array('first_name', $information_to_display)) {
Expand All @@ -42,10 +45,10 @@ if ( $the_query->have_posts() ) { ?>
the_field('last_name');
};
echo '</h4>';
};

};
echo '</a>';

if (in_array('title', $information_to_display)) {
echo '<p class="person-title">';
$titlePieces = explode(";", get_field('title'));
Expand Down Expand Up @@ -74,7 +77,7 @@ if ( $the_query->have_posts() ) { ?>
echo '<p class="person-file">';
echo '<a href="'.$file['url'].'">'.$file['title'].'</a>';
echo '</p>';
}
}
};
if (in_array('email', $information_to_display)) {
echo '<p class="person-email">';
Expand Down Expand Up @@ -126,17 +129,18 @@ if ( $the_query->have_posts() ) { ?>
}; ?>
</div><!-- /person -->
</div> <!-- /col -->

<?php
// check to see if we need to close this row...
<?php
// check to see if we need to close this row...
if ($person_count % 4 == 0){
// if this is the 4th, 8th, 16th, etc person...
echo '</div><!-- /row --><div class="row">';
// if this is the 4th, 8th, 16th, etc person...
echo '</div><!-- /row --><div class="row">';
}
$person_count++;
$person_count++;
} //end of posts?>
</div><!-- last row -->
<?php
<?php
} else {
// no posts found
}; ?>
}; ?>

9 changes: 8 additions & 1 deletion inc/people-table.php
Expand Up @@ -68,7 +68,14 @@ if ( $the_query->have_posts() ) {
echo '</a></td>';
}
if (in_array('first_name', $information_to_display) || in_array('middle_name', $information_to_display) || in_array('last_name', $information_to_display)){
echo '<td class="person-name"><a href="'.get_the_permalink().'">';
echo '<td class="person-name">';
$external_url = get_field('external_url');
if ( $external_url != "" ){
echo '<a href="'.$external_url.'" target="_blank">';
}else{
echo '<a href="'.get_the_permalink().'">';
}

if (in_array('first_name', $information_to_display)) {
the_field('first_name');
echo ' ';
Expand Down
17 changes: 13 additions & 4 deletions search.php
Expand Up @@ -19,10 +19,19 @@ get_header(); ?>
</header><!-- .page-header -->

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<h3><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h3>
<p><?php the_excerpt(); ?></p>
<?php while ( have_posts() ) : the_post();?>
<?php
$url = get_field('external_url');
if( empty($url) ){
$url = '<a href="'.get_permalink().'">';
}else{
$url = '<a href="'.$url.'" target="_blank">';
}
?>

<h3><?php echo $url; ?><?php the_title();?></a></h3>

<?php the_excerpt(); ?> <!-- e.g. "All about jellyfish" -->

<?php endwhile; ?>

Expand Down
3 changes: 2 additions & 1 deletion single-person.php
Expand Up @@ -2,7 +2,8 @@
/**
* Used for displaying the 'person' post type.
*/

$external_url = get_field('external_url');
if(!empty($external_url)) wp_redirect($external_url);
get_header(); ?>
<?php include('inc/sidebar-check.php')?>
<div id="page-page">
Expand Down

0 comments on commit d79d2ff

Please sign in to comment.