Skip to content

Instantly share code, notes, and snippets.

Avatar

2Fwebd

  • Alkaweb
View GitHub Profile
@2Fwebd
2Fwebd / functions.php
Created Apr 24, 2019
Ticket #1978249
View functions.php
/**
* Woffice members filter query
* See bp_nouveau_ajax_querystring() for details
*
* @since 2.8.0
*
* @param $query_string
*
* @return string
*/
View functions.php
<?php
function remove_eonet_ui() {
wp_dequeue_style( 'eonet-ui-css' );
}
add_action( 'wp_print_styles', 'remove_eonet_ui', 100 );
View wofficeMembersMap.js
/**
* 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();
View wofficeMembersMap.js
/**
* Fetch the Members locations using AJAX
*
* The action sent to the WordPress router is: woffice_map_members
*/
fetchLocations: function () {
var self = this;
$.ajax({
View wofficeMembersMap.js
mounted: function() {
this.createMap();
this.fetchLocations();
},
View wofficeMembersMap.js
(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,
View Woffice_Members.php
<?php
/**
* The public Google API key used for the Google Map API
*
* @var string
*/
private $publicApiKey = 'yyyyyyy';
View wofficeMembersMap.js
(function() {
Vue.component('woffice-members-map', {
template: '<div id="woffice-members-map__content"></div>',
props: ['url', 'height'],
data: function () {
return {
loaded: false,
members: []
}
},
View Woffice_Members_Map.php
<?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>
View Woffice_Members_Map.php
// Register our shortcode
add_shortcode( 'woffice_members_map', array($this, 'shortcode'));