Skip to content

Instantly share code, notes, and snippets.

View ciccarone's full-sized avatar
:octocat:

Tony Ciccarone ciccarone

:octocat:
View GitHub Profile
@mattradford
mattradford / acf_get_directions.php
Last active February 16, 2023 12:08
ACF Get Directions map link
<?php
$location = get_field('map_location');
if ( !empty( $location ) ) :
$map_url = 'https://www.google.com/maps/dir/?api=1&destination=' . $location['lat'] . ',' . $location['lng'];
echo '<a href=". esc_url( $map_url ) . '" rel="nooopener">Get directions</a>';
endif;
?>
<p>This should produce a link like this:</p>
<a href="https://www.google.com/maps/dir/?api=1&destination=51.072159,1.088130">Get directions</a>
@richardscholtens
richardscholtens / wp-hierarchical-taxonomy.php
Last active April 5, 2023 10:51 — forked from ciccarone/wp-hierarchical-taxonomy.php
Just a way to programmatically add hierarchical taxonomies in WordPress
// For one level deep Wordpress nested terms.
$taxonomy_term = 'example';
$related_terms = array(
__( 'Parent' ) => array(
__( 'Child 1' ),
__( 'Child 2' ),
),
__( 'Parent 2') => array(
@isaaacme
isaaacme / gist:a8bb3e335a8ef6593c514db008b41340
Created January 24, 2024 08:16
Enable SVG Support in WordPress
// Allow SVG
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
global $wp_version;
if ( $wp_version !== '4.7.1' ) {
return $data;
}
$filetype = wp_check_filetype( $filename, $mimes );