Skip to content

Instantly share code, notes, and snippets.

View mwangepatrick's full-sized avatar

Patrick N. Mwange mwangepatrick

View GitHub Profile
@mwangepatrick
mwangepatrick / dequeue_select_2.php
Last active November 25, 2017 08:33
ACF : Dequeue select2 Js
<?php
//here is the correct way to dequeue the select2 js used by acf
function my_acf_init() {
acf_update_setting('enqueue_select2', false); //this value defaults to true
}
add_action('acf/init', 'my_acf_init');
@JiveDig
JiveDig / acf_create_posts_acf_form.php
Last active February 28, 2023 06:29
Page template to create posts on the front end via Advanced Custom Fields Pro
<?php
/**
* Template Name: Create Post
*
* @author Mike Hemberger
* @link http://thestizmedia.com/front-end-posting-with-acf-pro/
* @uses Advanced Custom Fields Pro
*/
/**
@thisislawatts
thisislawatts / update.php
Last active May 25, 2021 02:54
Force database upgrade
<?php
class acf_update {
/*
* __construct
*
* A good place to add actions / filters
*
* @type functionac
@mwangepatrick
mwangepatrick / sort_repeater
Last active August 21, 2016 11:27
This is a sample code on how to sort repeater fields
<head>
<?php
wp_head();
?>
</head>
<body>
<?php
@cecilemuller
cecilemuller / gist:3081392
Created July 10, 2012 05:44
PostgreSQL: UPDATE if the row exists, INSERT if it doesn't exists (UPSERT)
CREATE OR REPLACE FUNCTION upsert_tableName(arg1 type, arg2 type) RETURNS VOID AS $$
DECLARE
BEGIN
UPDATE tableName SET col1 = value WHERE colX = arg1 and colY = arg2;
IF NOT FOUND THEN
INSERT INTO tableName values (value, arg1, arg2);
END IF;
END;
$$ LANGUAGE 'plpgsql';