Function Reference: geodir_excerpt_length

Summary

Changing excerpt length.

Global Values

$wp_query
(object) (required) WordPress Query object.

Default: None
$geodir_is_widget_listing
(bool) (required) Is this a widget listing?.

Default: None

Package

GeoDirectory

Parameters

$length
(int) (optional) Old length.

Default: None

Return Values

(mixed|void)
  • Returns length.

Change Log

Since: 1.0.0

1.5.7 Hide description when description word limit is 0.

Source File

geodir_excerpt_length() is located in geodirectory-functions/post_functions.php [Line: 2668]

Source Code

function geodir_excerpt_length($length)
{
    global $wp_query, $geodir_is_widget_listing;
	if ($geodir_is_widget_listing) {
		return $length;
	}
	
    if (isset($wp_query->query_vars['is_geodir_loop']) && $wp_query->query_vars['is_geodir_loop'] && get_option('geodir_desc_word_limit'))
        $length = get_option('geodir_desc_word_limit');
    elseif (get_query_var('excerpt_length'))
        $length = get_query_var('excerpt_length');

    if (geodir_is_page('author') && get_option('geodir_author_desc_word_limit'))
        $length = get_option('geodir_author_desc_word_limit');

    return $length;
}