Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
hereswhatidid / acf-gf-dropdown.php
Last active September 10, 2021 00:07
Populate ACF drop down with Gravity Forms forms
<?php
namespace HWID\ACFGravity;
class ACF_GF_DropDown {
public static function init() {
add_filter( 'acf/load_field/key=FIELDKEY', [ 'HWID\ACFGravity\ACF_GF_DropDown', 'populate_gform_dropdown' ] );
@hereswhatidid
hereswhatidid / woo-product-schema.php
Created September 11, 2018 13:47
Customize the schema for WooCommerce products
<?php
/*
* This class will customize the WooCommerce product schema markup
*/
namespace HWID\Woo;
class CustomizeSchema {
static function init() {
add_filter( 'woocommerce_structured_data_product', [ 'HWID\Woo\CustomizeSchema', 'override_schema_markup' ], 10, 2 );
}
@hereswhatidid
hereswhatidid / disable-yoast-cpt.php
Created August 16, 2018 12:28
Disable Yoast fields on a custom post type
<?php
/*
* This class will disable Yoast SEO fields on the edit screen for a particular post type
*/
namespace HWID\CustomPostType;
class DisableYoast {
static function init() {
// The important aspect of this add_action is to make sure it's set to at least 11 in priority
add_action( 'add_meta_boxes', [ 'HWID\CustomPostType\Expertise', 'remove_yoast' ], 11 );
@hereswhatidid
hereswhatidid / variations-link-chooser.php
Created August 14, 2018 16:05
Add WooCommerce product variations to the WordPress Link Chooser
@hereswhatidid
hereswhatidid / gforms-merge-tag.php
Last active November 3, 2023 06:12
Create a custom Gravity Forms merge tag
<?php
namespace HWID\SampleCode;
class GravityForms {
public static function init() {
add_filter( 'gform_custom_merge_tags', [ 'HWID\SampleCode\GravityForms', 'custom_merge_tags' ], 10, 4 );
add_filter( 'gform_replace_merge_tags', [ 'HWID\SampleCode\GravityForms', 'replace_merge_tags' ], 10, 3 );
}
/**
@hereswhatidid
hereswhatidid / _gravity-forms.less
Created June 20, 2018 13:06
Gravity Forms basic styling via LESS
.gform_wrapper {
@fieldBorder: @lightGray;
@fieldBg: @xLightBlue;
@focusBorder: @aqua;
@focusBg: @white;
@fieldGutter: 14px;
@halfGutter: @fieldGutter / 2;
@hereswhatidid
hereswhatidid / gw-require-list-columns.php
Created May 3, 2018 13:45 — forked from spivurno/gw-require-list-columns.php
Gravity Wiz // Require All Columns of List Field
<?php
/**
* Require All Columns of List Field
* http://gravitywiz.com/require-all-columns-of-list-field/
*/
class GWRequireListColumns {
private $field_ids;
public static $fields_with_req_cols = array();
@hereswhatidid
hereswhatidid / files.txt
Created April 17, 2018 15:16
Download a list of files via wget
https://placeimg.com/800/600/nature?cid=1
https://placeimg.com/800/600/nature?cid=2
https://placeimg.com/800/600/nature?cid=3
https://placeimg.com/800/600/nature?cid=4
https://placeimg.com/800/600/nature?cid=5
https://placeimg.com/800/600/nature?cid=6
https://placeimg.com/800/600/nature?cid=7
https://placeimg.com/800/600/nature?cid=8
https://placeimg.com/800/600/nature?cid=9
https://placeimg.com/800/600/nature?cid=10
@hereswhatidid
hereswhatidid / close-comments.sql
Created November 21, 2017 16:00
Set all comment statuses to closed in WordPress
UPDATE wp_posts
SET comment_status = 'closed'
WHERE comment_status = 'open';
UPDATE wp_posts
SET ping_status = 'closed'
WHERE ping_status = 'open';
@hereswhatidid
hereswhatidid / acf-sample-options.php
Last active April 22, 2019 10:35
Set correct language for ACF options pages with custom post_id
<?php
class ACF_SampleOptions_Page {
static $slug = 'sample_options_slug';
static $post_id = 'sample_options_id';
public static function init() {