Skip to content

Instantly share code, notes, and snippets.

@carmoreira
carmoreira / gist:d01f9b223687b94a3c9274061fd441f1
Created May 2, 2018 16:19
Connect Markers in Interactive World Maps
function iwm_callback() {
var connectmap = jQuery('#map_canvas_1');
if(connectmap.length > 0 && !connectmap.hasClass('iwm_connected')){
iwm_connect('1','#f03b21','#f03b22','red',1,'dashed-arrow');
iwm_connect('1','#f03b22','#f03b23','#667788',1,'curved-arrow');
iwm_connect('1','#f03b23','#6699cc','#667788',1,'dashed-curved-arrow');
connectmap.addClass('iwm_connected');
}
}
@carmoreira
carmoreira / gist:a377c38521bfe142189f7f0690a39a12
Created June 7, 2018 15:58
Add Custom Post Type Support for Yet Another Related Posts Plugin
<?php
/**
* Filter the CPT to register more options
*
* @param $args array The original CPT args.
* @param $post_type string The CPT slug.
*
* @return array
*/
@carmoreira
carmoreira / register_cpt.php
Created June 7, 2018 16:25
Register Custom Post Type with YARPP support
function register_my_cpt() {
$args = array(
'public' => true,
'label' => 'Books'
'yarpp_support' => true,
);
register_post_type( 'book', $args );
}
add_action( 'init', 'register_my_cpt' );
@carmoreira
carmoreira / hide_empty_tooltips.css
Last active August 27, 2018 13:42
Hide Empty Tooltips Geochart API - Interactive World Maps WordPress Plugin
/*
INSTRUCTIONS:
1. replace _1 with the ID of your map.
2. use the 'tooltip' field to add your information. The 'title' field will not display.
*/
/* this will hide an empty div the tooltip has, which may cause some white space */
.iwm_map_canvas #map_canvas_1 li.google-visualization-tooltip-item:first-child { display:none; box-shadow:none; }
/* this will hide the element in case it is empty */
@carmoreira
carmoreira / team-showcase-order.php
Created June 12, 2018 17:10
Team Showcase Order
//Order for Fields
add_filter('tshowcase_content_order','my_tshowcase_content_order');
function my_tshowcase_content_order($tshowcase_fields){
$ts_content_order = array(
1 => 'title',
2 => 'groups',
3 => 'taxonomy',
4 => 'ctaxonomy',
5 => 'dtaxonomy',
@carmoreira
carmoreira / create_multisite_wp_cli
Last active July 6, 2018 13:12
WP CLI commands to create a multisite network on your localhost
wp core download
wp config create --dbname="database_name" --dbuser="database_user" --dbpass="database_pass"
wp core multisite-install --title="Welcome to the WordPress" --admin_user="admin" --admin_password="password" --admin_email="email@gmail.com" --url="http://localhost" --skip-email
@carmoreira
carmoreira / functions.php
Last active July 7, 2021 09:54
Fix to use Advisor Quiz and Flatsome UX Builder
if(array_key_exists( 'page', $_GET ) && $_GET['page'] == 'uxbuilder'){
remove_action('init', 'advq_metaboxes_init',89);
}
if(array_key_exists( 'uxb_iframe', $_GET )){
remove_action('init', 'advq_metaboxes_init',89);
}
if(array_key_exists( 'ux_builder_action', $_POST ) && $_POST['ux_builder_action'] == 'do_shortcode'){
@carmoreira
carmoreira / get_multisite_themes.php
Created August 6, 2018 16:53
Get multisite themes being used
if ( function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
$sites = get_sites();
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
$curr = get_blog_details();
$theme = wp_get_theme();
echo '<h1>' . $curr->blogname . '</h1>';
echo $theme->Name;
$style_parent_theme = wp_get_theme(get_template());
@carmoreira
carmoreira / new_url_mobile.js
Created August 17, 2018 23:08
Interactive World Maps: Open new URL only on mobile
jQuery( document ).ready(function() {
var isMobile = window.matchMedia("only screen and (max-width: 760px)");
if (isMobile.matches) {
iwmparam[0]['action'] = 'i_map_action_open_url_new';
}
});
@carmoreira
carmoreira / salient-fix.js
Created August 21, 2018 09:53
jQuery fix to allow Team Showcase Lightbox to work on Salient theme
jQuery(document).ready(function(){
jQuery( '[data-featherlight]' ).each( function(){
jQuery(this).attr('data-featherlight', jQuery(this).attr('href'))
.removeAttr("href");
});
});