Skip to content

Instantly share code, notes, and snippets.

View Pamps's full-sized avatar

Darren Lambert Pamps

View GitHub Profile
@Pamps
Pamps / various
Last active April 29, 2022 15:58
Default WordPress setup
in wp-config.php
define( 'DISALLOW_FILE_EDIT', true ); // disable file editor
define( 'WP_POST_REVISIONS', 10 ); // keep last 10 revisions
in functions.php
add_filter( 'auto_update_plugin', '__return_true' ); // auto update plugins
@Pamps
Pamps / 3 digit country code list
Created September 2, 2022 16:51
3 digit country code list, useful for ACF
AFG : Afghanistan
ALA : Åland Islands
ALB : Albania
DZA : Algeria
ASM : American Samoa
AND : Andorra
AGO : Angola
AIA : Anguilla
ATA : Antarctica
ATG : Antigua and Barbuda
@Pamps
Pamps / get_post_count_for_term_and_post_type.php
Last active January 25, 2023 13:48
WordPress: How to get the post count for a term and post type. Found out more at https://www.darrenlambert.com/wordpress-how-to-get-the-post-count-for-a-term-and-post-type/
/**
* Returns the number of posts for a term in a taxonomy, for a post type
* Found out more at https://www.darrenlambert.com/wordpress-how-to-get-the-post-count-for-a-term-and-post-type/
* @param string $post_type
* @param string $taxonomy
* @return int count
*/
function get_post_count_for_term_and_post_type( $term_id, $taxonomy, $post_type ) {
// Build the args
@Pamps
Pamps / get-gtm-value-and-update-form-input.js
Last active October 16, 2024 11:14
Get value from GTM, and update a form input
/**
* Get value from GTM, and update a form input
*/
( function () {
window.addEventListener( "load", function () {
// Check for our form
const form = document.querySelector( '.our-form' );
if ( ! form ) return;