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

fixed people links on business search results #4

Merged
merged 2 commits into from Apr 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 10 additions & 3 deletions search.php
Expand Up @@ -21,18 +21,25 @@ get_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">';
}elseif(strlen(get_the_content()) > 0){
}elseif(strlen(get_the_content()) > 0 || $is_person_post_type){
$url = '<a href="'.get_permalink().'">';
}

?>

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

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

<?php endwhile; ?>

Expand Down