• Resolved aljuk

    (@aljuk)


    I need to check if a map exists for a single post, eg.

    if(single_map_esists($post->ID)) {
    // do something
    }

    Is there a built-in conditional for this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Eyal Fitoussi

    (@ninjew)

    Hello @aljuk,

    You can probably use the function:

    
    gmw_get_post_location( $post->ID );
    

    The function will try to get the location of a post. If it returns empty it means that the post does not have a location.

    So something like:

    
    $post_location = gmw_get_post_location( $post->ID );
    
    if ( ! empty( $post_location ) ) {
        // do something.
    }
    
    • This reply was modified 3 years, 8 months ago by Eyal Fitoussi.
    Thread Starter aljuk

    (@aljuk)

    Great stuff!

    Many thanks.

    Plugin Author Eyal Fitoussi

    (@ninjew)

    You are welcome, @aljuk.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional test for single map ?’ is closed to new replies.