Skip to content

Instantly share code, notes, and snippets.

@carmoreira
carmoreira / style.css
Created January 20, 2023 22:59
Fix lightbox causing page to jump to top - Interactive Geo Maps
html, body {
height: initial !important;
}
/* to override height:100% which caused the issue */
@carmoreira
carmoreira / filter.js
Created January 19, 2023 23:39
Testomonials Showcsase hashtag filter select
jQuery(document).ready(function(){
var thishash = window.location.href.slice(window.location.href.indexOf('#') + 1);
var menuitem = 'ul#tts-filter-nav li:contains("'+thishash+'")';
if(thishash.length && menuitem.length){
jQuery(menuitem).click();
}
});
@carmoreira
carmoreira / style.css
Created January 4, 2023 11:21
Advisor quiz - answer commentary with color code for correct or incorrect answers
/* Incorrect */
.advq_question_container:has(li.quiz_incorrect_answer) .advq_answer_commentary { background:red !important; color:#fff !important; }
/* Correct */
.advq_question_container:has(li.quiz_correct_answer) .advq_answer_commentary { background:green !important; color:#fff !important; }
@carmoreira
carmoreira / globals.js
Last active December 27, 2022 14:35
Global variables to alter behaviour on Interactive Geo Maps
/*
* Zoom Level for Markers on Click with Zoom on Click enabled
* if you do not override the value, it will default to zoom to
* the value double of the current zoom.
*/
let igmMarkerZoomLevelOnClick = 32;
/*
* Opacity for base region series when drilldown or show specific map action is perfomed
*/
@carmoreira
carmoreira / style.css
Last active November 29, 2022 11:20
Full height map css hack - Interactive Geo Maps
.map_wrapper .map_aspect_ratio {
padding-top: 0 !important;
height: calc(100vh) !important;
max-height: calc(100vh) !important;
}
/* If you only want it on smaller screens */
@media only screen and (max-width: 768px) {
@carmoreira
carmoreira / fix.php
Last active November 8, 2022 11:24
Fix themes ui js interfeering with switch buttons on advisor quiz
// All Elated Themes
add_action('admin_enqueue_scripts','kendal_advisor_quiz_fix', 100);
function kendal_advisor_quiz_fix() {
$current_screen = get_current_screen();
if( $current_screen->id === "advquiz" ) {
wp_deregister_script('eltd-ui-admin');
wp_dequeue_script('eltd-ui-admin');
wp_deregister_script('eltdf-ui-admin-skin');
wp_dequeue_script('eltdf-ui-admin-skin');
@carmoreira
carmoreira / igm-cpt-addon.php
Created May 2, 2021 17:18
Interactive Geo Maps - Custom Addon to populate map from Custom Post Type
<?php
/**
* Interactive Geo Maps Callback
*
* @wordpress-plugin
* Plugin Name: Interactive Geo Maps CPT Addon
* Plugin URI: https://interactivegeomaps.com
* Description: Connects CPT with map
* Version: 1.0.0
* Author: Carlos Moreira
@carmoreira
carmoreira / lightbox.js
Last active September 7, 2022 13:31
Interactive Geo Maps - Reset map to home position (goHome) when closing lightbox
// replace with your map ID
let mapID = 3491625;
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready', function(ev) {
iMaps.maps[mapID].series[0].mapPolygons.each(function(region) {
region.events.on("hit", function(ev) {
setTimeout(function(){
iMapsActions.lightbox.on('close', function(){
iMapsManager.clearSelected(mapID);
iMaps.maps[mapID].map.goHome();
@carmoreira
carmoreira / front.php
Created July 18, 2022 10:04
Add more share button to Advisor Quiz WordPress plugin
// Replace this function in your front.php to give customers more share buttons.
function advq_get_after_results_content($id,$data,$options) {
$html = '';
if(isset($data['code_after_results']) && $data['code_after_results'] != ''){
$html .= '<div class="advq_integration_after_results">';
if( $options['render_shortcodes_integration'] ){
@carmoreira
carmoreira / pan.js
Last active June 22, 2022 09:01
Interactive Geo Maps - Remove Pan out limit - allow map to be dragged beyond the limits
// replace with your map ID.
let mapID = 877;
let mapContainer = document.getElementById('map_' + mapID);
mapContainer.addEventListener('mapready',function(ev){
iMaps.maps[mapID].map.maxPanOut = 10;
});