if($type == get_post_type($wp_query->post->ID)) return true;
return false;
}
+function get_excerpt_by_id($post_id, $length = 35){
+ $the_post = get_post($post_id); //Gets post ID
+ if( $the_post->post_excerpt ){
+ $the_excerpt = $the_post->post_excerpt;
+ } else {
+ $the_excerpt = $the_post->post_content;
+ }
+
+ $excerpt_length = $length; //Sets excerpt length by word count
+ $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images
+ $words = explode(' ', $the_excerpt, $excerpt_length + 1);
+
+ if(count($words) > $excerpt_length) :
+ array_pop($words);
+ array_push($words, '…');
+ $the_excerpt = implode(' ', $words);
+ endif;
+// $the_excerpt = '<p>' . $the_excerpt . '</p>';
+
+ return $the_excerpt;
+}
+?>
add_action('thematic_searchloop', 'mytheme_search_loop');
// End of the Contextual/Highlight Search functions
?>
$city_page = get_posts($args);
// echo '<pre>', print_r($city_page), '</pre>';
if( !empty($city_page) ){
- // $content = get_excerpt_by_id($city_page[0]->ID, 55);
- $content = get_the_excerpt($city_page[0]->ID);
+ $content = get_excerpt_by_id($city_page[0]->ID, 40);
+ // $content = get_the_excerpt($city_page[0]->ID);
$city_image_id = get_post_thumbnail_id($city_page[0]->ID);
$city_image = wp_get_attachment_image_src( $city_image_id, 'glm-map-image', true);
$city_url = get_permalink($city_page[0]->ID);