Function Reference: geodir_cpt_listing_page_title

Summary

Outputs the listings template title.

Global Values

$wp
(object) (required) The WordPress object.

Default: None
$term
(string) (required) Current term slug.

Default: None

Parameters

$list_title
(string) (required) The post page title.

Default: None

Return Values

(string)
  • The post page title.

Change Log

Since: 1.1.6

Source File

geodir_cpt_listing_page_title() is located in geodir_custom_posts/geodir_cp_functions.php [Line: 1316]

Source Code

function geodir_cpt_listing_page_title( $list_title = '' ) {
    global $wp, $term;

    $gd_post_type = geodir_get_current_posttype();
	if ( !geodir_cpt_no_location( $gd_post_type ) ) {
		return $list_title;
	}
    $post_type_info = get_post_type_object( $gd_post_type );

    $add_string_in_title = __( 'All', GEODIR_CP_TEXTDOMAIN ) . ' ';
    if ( isset( $_REQUEST['list'] ) && $_REQUEST['list'] == 'favourite' ) {
        $add_string_in_title = __( 'My Favorite', GEODIR_CP_TEXTDOMAIN ) . ' ';
    }

    $list_title = $add_string_in_title . __( ucfirst( $post_type_info->labels->name ), GEODIR_CP_TEXTDOMAIN );
    $single_name = $post_type_info->labels->singular_name;

    $taxonomy = geodir_get_taxonomies($gd_post_type, true);

    if (!empty($term)) {
        $current_term_name = '';
		
		$current_term = get_term_by( 'slug', $term, $taxonomy[0] );
		if ( !empty( $current_term ) ) {
            $current_term_name = __( ucfirst( $current_term->name ), GEODIR_CP_TEXTDOMAIN );
        } else {
            if (count($taxonomy) > 1) {
                $current_term = get_term_by( 'slug', $term, $taxonomy[1] );

                if (!empty($current_term)) {
                    $current_term_name = __( ucfirst( $current_term->name ), GEODIR_CP_TEXTDOMAIN );
                }
            }
        }
		
		if ( $current_term_name != '' ) {
			$list_title .= __(' in', GEODIR_CP_TEXTDOMAIN ) . " '" . $current_term_name . "'";
		}

    }

    if ( is_search() ) {
        $list_title = __( 'Search', GEODIR_CP_TEXTDOMAIN ) . ' ' . __( ucfirst( $post_type_info->labels->name ), GEODIR_CP_TEXTDOMAIN ) . __(' For :', GEODIRECTORY_TEXTDOMAIN ) . " '" . get_search_query() . "'";
    }
	return $list_title;
}