Function Reference: geodir_cpt_post_view_class

Summary

Add a class to the `li` element of the listings list template.

Global Values

$post
(WP_Post) (required) Post object.

Default: current post

Parameters

$class
(string) (required) Css style class.

Default: None
$all_postypes
(array) (required) Array of post types.

Default: empty

Return Values

(string)
  • Css style class.

Change Log

Since: 1.1.6

Source File

geodir_cpt_post_view_class() is located in geodir_custom_posts/geodir_cp_functions.php [Line: 1192]

Source Code

function geodir_cpt_post_view_class( $class, $all_postypes = '' ) {
	global $post;

    $gdp_post_id = !empty($post) && isset($post->ID) ? $post->ID : NULL;
    $gdp_post_type = $gdp_post_id > 0 && isset($post->post_type) ? $post->post_type : NULL;

    if ( $gdp_post_id && $gdp_post_type ) {
        if ( geodir_cpt_no_location( $gdp_post_type ) ) {
			$class .= ' gd-post-no-geo';
		}
    }

    return $class;
}