Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix links for people pages not showing up in search results
  • Loading branch information
jjc16105 committed Apr 20, 2016
1 parent 84d18fd commit 237e696
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions search.php
Expand Up @@ -15,23 +15,31 @@ get_header(); ?>
<?php if ( have_posts() ) : ?>

<header class="entry-header">

<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'cs' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'cs' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
</header><!-- .page-header -->

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

$post = get_post( get_the_ID() );

// is this a 'person' or a 'page' post type?
$is_person_post_type = ( $post->post_type == "person" );

$url = get_field('external_url');
if( !empty($url) ){
$url = '<a href="'.$url.'" target="_blank">';
}else{
}elseif(strlen(get_the_content()) > 0 || $is_person_post_type){
$url = '<a href="'.get_permalink().'">';
}

?>

<h3><?php echo $url; ?><?php echo the_title() . '</a>';?></h3>
<?php the_excerpt(); ?>
<h3><?php echo $url; ?><?php the_title();?></h3>
<?php if(strlen(get_the_content()) > 0 || !empty($url) || $is_person_post_type) echo '</a>'; ?>

<?php the_excerpt(); ?>

<?php endwhile; ?>

Expand Down

0 comments on commit 237e696

Please sign in to comment.