Skip to content

Instantly share code, notes, and snippets.

View 2Fwebd's full-sized avatar

2Fwebd

  • Alkaweb
View GitHub Profile
@2Fwebd
2Fwebd / functions.php
Created April 24, 2019 22:43
Ticket #1978249
/**
* Woffice members filter query
* See bp_nouveau_ajax_querystring() for details
*
* @since 2.8.0
*
* @param $query_string
*
* @return string
*/
<?php
function remove_eonet_ui() {
wp_dequeue_style( 'eonet-ui-css' );
}
add_action( 'wp_print_styles', 'remove_eonet_ui', 100 );
/**
* Draw the marker of the members on the map
*
* So we can see them
*/
drawMarkers: function() {
var self = this;
var infowindow = new google.maps.InfoWindow();
/**
* Fetch the Members locations using AJAX
*
* The action sent to the WordPress router is: woffice_map_members
*/
fetchLocations: function () {
var self = this;
$.ajax({
mounted: function() {
this.createMap();
this.fetchLocations();
},
(function() {
Vue.component('woffice-members-map', {
template: '<div id="woffice-members-map__content"></div>',
props: ['url', 'height'],
data: function () {
return {
loaded: false,
mapObject: null,
center: {
lat: 50.629250,
<?php
/**
* The public Google API key used for the Google Map API
*
* @var string
*/
private $publicApiKey = 'yyyyyyy';
(function() {
Vue.component('woffice-members-map', {
template: '<div id="woffice-members-map__content"></div>',
props: ['url', 'height'],
data: function () {
return {
loaded: false,
members: []
}
},
<?php
/**
* Register our [woffice_members_map] shortcode
*
* @return string
*/
public function shortcode()
{
return '<div id="woffice-members-map__wrapper">
<woffice-members-map :url="'. admin_url( 'admin-ajax.php' ) .'" :height="200"></woffice-members-map>
// Register our shortcode
add_shortcode( 'woffice_members_map', array($this, 'shortcode'));