定制 franc-liuzzi/ep-geo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

franc-liuzzi/ep-geo

最新稳定版本:0.2.2

Composer 安装命令:

composer require franc-liuzzi/ep-geo

包简介

Geo query integration for ElasticPress

README 文档

README

Geo query integration for ElasticPress

Installation

  1. Follow installation instructions for ElasticPress.
  2. Install and activate this plugin (ep-geo) in WordPress.
  3. Navigate to Admin > ElasticPress and activate "Geo".

Usage

By default, this plugin looks in post meta fields named "latitude" and "longitude". They should be plain text fields with lat/lon represented as floats.

Find posts within 30mi of Portland, OR, USA, ordered by distance:

new WP_Query( array(
    'ep_integrate'   => true,
    'posts_per_page' => 100,
    'post_type'      => 'post',
    'orderby'        => 'geo_distance',
    'order'          => 'asc',
    'geo_distance'   => array(
        'distance'           => '30mi',
        'geo_point.location' => array(
            'lat' => 45.5231,
            'lon' => -122.6765,
        ),
    ),
) );

If your latitude and longitude data is stored somewhere else, or if you need to calculate or preprocess the geo_point location, it's configurable with a WordPress hook:

/**
 * Alter geo_point location to use my_lat/my_lon.
 */
add_filter( 'ep_geo_post_sync_geo_point', function ( $geo_point, $post_args, $post_id ) {
	$geo_point['location']['lat'] = get_field( 'my_lat', $post_id );
	$geo_point['location']['lon'] = get_field( 'my_lon', $post_id );

	return $geo_point;
}, 10, 3 );

统计信息

  • 总下载量: 1.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固