Skip to content

Instantly share code, notes, and snippets.

View SebastienGicquel's full-sized avatar
💭
Coding

Sébastien Gicquel SebastienGicquel

💭
Coding
View GitHub Profile
@SebastienGicquel
SebastienGicquel / readme.md
Last active April 23, 2020 12:11 — forked from Yves-T/readme.md
DRUSH: How to install on mamp mac osx

#Installing Drush on MAMP

##Use PHP version of MAMP

XCode also installs a version of php on the command line. We want to use the mamp version of php. First check which version is running on your mamp installation. ( mamp panel -> preferences -> PHP ). In my case this is php5.6.10.

Launch the terminal app and type

@SebastienGicquel
SebastienGicquel / querystring.php
Created October 17, 2016 22:13 — forked from andho/querystring.php
Convert associative array into a query string
<?php
$params = array(
'query' => 'something',
'page' => 1,
'items' => 10
);
$url = 'http://someapi.com/search';
jQuery.post(
ajaxurl,
{
'action': 'load_acf_form_ajax',
'fields_key': $field_key,
'user_id': <?php echo $user_id_parameter; ?>
},
function (response, status) {
//console.log(response);
$('#modal_content').html("Chargement...");
@SebastienGicquel
SebastienGicquel / gist:39051694659e944cdd02
Created September 1, 2015 21:05
Index facetWP Google Map adress
// index lieux tournage pays
function index_acf_google_map_address($params) {
if ('films_acf_lieux_de_tournage_pays' == $params['facet_name']) {
$address = $params['facet_value']['address']; // sinon essayer $params['facet_value'][0]['address']
$params['facet_value'] = $address;
$params['facet_display_value'] = $address;
}
return $params;
}
@SebastienGicquel
SebastienGicquel / gist:b4663cfd2e9b1a376c7a
Created September 1, 2015 15:13
ACF display Array values
// Lieux de tournage - Pays ----------------------------------------
$subfield_slug_pays_tournage = 'lieux_tournage_pays';
$pays_tournage = get_sub_field($subfield_slug_pays_tournage);
echo 'pays de tournage : ' . get_field($pays_tournage);
$values = get_field('lieux_tournage_pays');
if ($values) {
echo '<ul>';
foreach ($values as $value) {
@SebastienGicquel
SebastienGicquel / gist:eb6d7795a3e321209a6d
Created September 1, 2015 15:11
ACF Display Array values "pays de tournage"
pays de tournage :
Array
array(1) { [0]=> array(1) { ["lieu_tournage_pays"]=> array(3) { ["address"]=> string(6) "Serbie" ["lat"]=> string(9) "44.016521" ["lng"]=> string(18) "21.005858999999987" } } }
@SebastienGicquel
SebastienGicquel / gist:5c82195db7f8d29fb2ce
Created September 1, 2015 13:12
facet WP export : Films ACF Lieux de tournage - Pays
{"facets":[{"label":"Films ACF Lieux de tournage - Pays","name":"films_acf_lieux_de_tournage_pays","type":"checkboxes","source":"acf\/field_55af906b85e13\/field_55b8748461524","parent_term":"","orderby":"count","operator":"and","hierarchical":"no","ghosts":"no","preserve_ghosts":"no","count":"10"}]}
@SebastienGicquel
SebastienGicquel / gist:7a644b8607c7eaed5ce3
Created September 1, 2015 13:09
ACF export Lieux de tournage - Pays
array (
'key' => 'field_55af906b85e13',
'label' => 'Lieux de tournage - Pays',
'name' => 'lieux_tournage_pays',
'type' => 'repeater',
'instructions' => 'Saisissez un ou plusieurs pays de tournage',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => 30,
{"facets":[{"label":"Films ACF genres","name":"films_acf_genres","type":"checkboxes","source":"acf\/field_55af8e71be4fc","parent_term":"","orderby":"count","operator":"and","hierarchical":"no","ghosts":"no","preserve_ghosts":"no","count":"10"},{"label":"films ACF structure","name":"films_acf_structure","type":"checkboxes","source":"acf\/field_55b88aeeb68df\/field_55b88aefb68e0","parent_term":"","orderby":"count","operator":"and","hierarchical":"no","ghosts":"no","preserve_ghosts":"no","count":"10"},{"label":"films acf theme","name":"films_acf_theme","type":"checkboxes","source":"acf\/field_55af8f33be4fd","parent_term":"","orderby":"count","operator":"and","hierarchical":"no","ghosts":"no","preserve_ghosts":"no","count":"10"}],"templates":[{"label":"Default","name":"default","query":"<?php\nreturn array(\n 'post_type' => 'any',\n 'posts_per_page' => 15,\n);","template":"<?php while ( have_posts() ) : the_post(); ?>\n <div><a href=\"<?php the_permalink(); ?>\"><?php the_title(); ?><\/a><\/div>\n<?php e