Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active July 8, 2020 14:42
Show Gist options
  • Save cliffordp/52d0bfb6d1537a19d158deb351dd9fa7 to your computer and use it in GitHub Desktop.
Save cliffordp/52d0bfb6d1537a19d158deb351dd9fa7 to your computer and use it in GitHub Desktop.

Revisions

  1. cliffordp revised this gist Sep 2, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functions.php
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    * Updated 2018-08-06 because PRO v4.4.30 removed one of the parameters.
    *
    * @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
    * @link https://www.mapdevelopers.com/draw-rectangle.php Find the coordinates of a box on a map. Selecting "DublinCore" output will be most helpful.
    * @link https://boundingbox.klokantech.com/ Find the coordinates of a box on a map. Selecting "DublinCore" output will be most helpful.
    * @link https://theeventscalendar.com/support/forums/topic/africa-really/
    */
    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_geocoordinates', 10, 2 );
  2. cliffordp revised this gist Aug 7, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    <?php

    /**
    * Events Calendar Pro: Change default coordinates for Map View starting center
    * and for when there are no event results found.
    * Events Calendar PRO: Change default coordinates and zoom level for Map View's
    * start location (for when there are no event results found, to avoid African coast).
    *
    * Change the coordinates to your liking. See the link below for a helpful tool.
    * Updated 2018-08-06 because PRO v4.4.30 removed one of the parameters.
  3. cliffordp revised this gist Aug 7, 2018. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    * and for when there are no event results found.
    *
    * Change the coordinates to your liking. See the link below for a helpful tool.
    * Updated 2018-08-06 to account for PRO version 4.4.30 removing one of the parameters.
    * Updated 2018-08-06 because PRO v4.4.30 removed one of the parameters.
    *
    * @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
    * @link https://www.mapdevelopers.com/draw-rectangle.php Find the coordinates of a box on a map. Selecting "DublinCore" output will be most helpful.
    @@ -18,8 +18,8 @@ function custom_map_view_starting_geocoordinates( $data, $object ) {
    $data['geocenter'] = array(
    'min_lat' => 40.477399, // south limit
    'max_lat' => 40.917577, // north limit
    'min_lng' => - 73.700272, // east limit
    'max_lng' => - 74.25909, // west limit
    'min_lng' => -73.700272, // east limit
    'max_lng' => -74.25909, // west limit
    );

    if (
    @@ -33,6 +33,5 @@ function_exists( 'tribe_is_map' )
    }
    }


    return $data;
    }
  4. cliffordp revised this gist Aug 7, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functions.php
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ function custom_map_view_starting_geocoordinates( $data, $object ) {
    function_exists( 'tribe_is_map' )
    && tribe_is_map()
    ) {
    // TODOchange to your preferred zoom level
    // TODO: change to your preferred zoom level
    add_filter( 'tribe_events_single_map_zoom_level', function ( $zoom_level ) {
    return 15;
    } );
  5. cliffordp revised this gist Aug 7, 2018. 1 changed file with 15 additions and 6 deletions.
    21 changes: 15 additions & 6 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -5,14 +5,14 @@
    * and for when there are no event results found.
    *
    * Change the coordinates to your liking. See the link below for a helpful tool.
    * Note that these coordinates only affect the CENTER of the map and not its
    * zoom level, no matter how tight your min/max pairs are.
    * Updated 2018-08-06 to account for PRO version 4.4.30 removing one of the parameters.
    *
    * @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
    * @link https://www.mapdevelopers.com/draw-rectangle.php Find the coordinates of a box on a map. Selecting "DublinCore" output will be most helpful.
    * @link https://theeventscalendar.com/support/forums/topic/africa-really/
    */
    function custom_map_view_starting_coordinates( $data, $owner, $object ) {
    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_geocoordinates', 10, 2 );
    function custom_map_view_starting_geocoordinates( $data, $object ) {
    if ( 'tribe-events-pro' === $object ) {
    // TODO: Tweak as needed to focus in on the desired geography (these ones are zoomed into New York City)
    $data['geocenter'] = array(
    @@ -21,9 +21,18 @@ function custom_map_view_starting_coordinates( $data, $owner, $object ) {
    'min_lng' => - 73.700272, // east limit
    'max_lng' => - 74.25909, // west limit
    );

    if (
    function_exists( 'tribe_is_map' )
    && tribe_is_map()
    ) {
    // TODOchange to your preferred zoom level
    add_filter( 'tribe_events_single_map_zoom_level', function ( $zoom_level ) {
    return 15;
    } );
    }
    }

    return $data;
    }

    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_coordinates', 10, 3 );
    return $data;
    }
  6. cliffordp revised this gist Jan 20, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion functions.php
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,8 @@
    * and for when there are no event results found.
    *
    * Change the coordinates to your liking. See the link below for a helpful tool.
    * Also change the zoom level of your Map View within this snippet.
    * Note that these coordinates only affect the CENTER of the map and not its
    * zoom level, no matter how tight your min/max pairs are.
    *
    * @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
    * @link https://www.mapdevelopers.com/draw-rectangle.php Find the coordinates of a box on a map. Selecting "DublinCore" output will be most helpful.
  7. cliffordp revised this gist Jan 20, 2018. 1 changed file with 13 additions and 8 deletions.
    21 changes: 13 additions & 8 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -4,20 +4,25 @@
    * Events Calendar Pro: Change default coordinates for Map View starting center
    * and for when there are no event results found.
    *
    * Change the coordinates to your liking. See the link below for a helpful tool.
    * Also change the zoom level of your Map View within this snippet.
    *
    * @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
    * @link https://www.mapdevelopers.com/draw-rectangle.php Find the coordinates of a box on a map. Selecting "DublinCore" output will be most helpful.
    * @link https://theeventscalendar.com/support/forums/topic/africa-really/
    */
    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_geocoordinates', 10, 3 );
    function custom_map_view_starting_geocoordinates( $data, $owner, $object ) {
    function custom_map_view_starting_coordinates( $data, $owner, $object ) {
    if ( 'tribe-events-pro' === $object ) {
    // Tweak as needed to focus in on the desired geography (these ones are near New York City)
    // TODO: Tweak as needed to focus in on the desired geography (these ones are zoomed into New York City)
    $data['geocenter'] = array(
    'min_lat' => 41,
    'max_lat' => 45,
    'min_lng' => -73,
    'max_lng' => -77,
    'min_lat' => 40.477399, // south limit
    'max_lat' => 40.917577, // north limit
    'min_lng' => - 73.700272, // east limit
    'max_lng' => - 74.25909, // west limit
    );
    }

    return $data;
    };
    }

    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_coordinates', 10, 3 );
  8. cliffordp revised this gist Jan 20, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion functions.php
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@
    * Events Calendar Pro: Change default coordinates for Map View starting center
    * and for when there are no event results found.
    *
    * @link
    * @link https://gist.github.com/cliffordp/52d0bfb6d1537a19d158deb351dd9fa7
    * @link https://theeventscalendar.com/support/forums/topic/africa-really/
    */
    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_geocoordinates', 10, 3 );
  9. cliffordp created this gist Jan 20, 2018.
    23 changes: 23 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <?php

    /**
    * Events Calendar Pro: Change default coordinates for Map View starting center
    * and for when there are no event results found.
    *
    * @link
    * @link https://theeventscalendar.com/support/forums/topic/africa-really/
    */
    add_filter( 'tribe_events_pro_localize_script', 'custom_map_view_starting_geocoordinates', 10, 3 );
    function custom_map_view_starting_geocoordinates( $data, $owner, $object ) {
    if ( 'tribe-events-pro' === $object ) {
    // Tweak as needed to focus in on the desired geography (these ones are near New York City)
    $data['geocenter'] = array(
    'min_lat' => 41,
    'max_lat' => 45,
    'min_lng' => -73,
    'max_lng' => -77,
    );
    }

    return $data;
    };