Skip to content

Instantly share code, notes, and snippets.

@polevaultweb
polevaultweb / acf_pro_license_constant.php
Last active March 22, 2023 03:06
Define the Advanced Custom Fields Pro license key with a constant
<?php
function my_filter_acf_pro_license_option( $pre ) {
if ( ! defined( 'ACF_PRO_LICENSE' ) || empty( ACF_PRO_LICENSE ) ) {
return $pre;
}
$data = array(
'key' => ACF_PRO_LICENSE,
'url' => home_url(),
@bradyvercher
bradyvercher / register-plugin-icons.php
Created October 4, 2017 22:30
Register icons to display on the Manage Plugins screen for plugins that aren't in the WordPress.org directory.
<?php
/**
* Register plugin icons.
*
* WordPress 4.9 introduced icons in the list table on the Manage Plugins
* screen. The icons are pulled from the W.org update API. If an icon isn't
* available, a generic plugin Dashicon is shown instead.
*
* @param array $value Plugin update data.
* @return array
# Ignore everything #
**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
# Add two rules for each Theme or Plugin you want to include:
@evanwebdesign
evanwebdesign / genesis-remove-custom-title-logo.php
Last active June 20, 2016 11:13
Remove custom title/logo from Genesis theme options and customizer
<?php
/* Removing custom title/logo metabox from Genesis theme options page.
* See http://www.billerickson.net/code/remove-metaboxes-from-genesis-theme-settings/
* Updated to use $_genesis_admin_settings instead of legacy variable in Bill's example.
*/
add_action( 'genesis_theme_settings_metaboxes', 'be_remove_metaboxes' );
function be_remove_metaboxes( $_genesis_admin_settings ) {
remove_meta_box( 'genesis-theme-settings-header', $_genesis_admin_settings, 'main' );
@ahmadawais
ahmadawais / Sublime-stuffs.txt
Created December 24, 2015 12:08 — forked from vishalbasnet23/Sublime-stuffs.txt
Install PHPCS with WordPress Coding Standard with Sublime Text 3
1. cmd+shift+p
2. Type phpcs and install it
3. Preferences > Package Settings > Php Code Sniffer > User settings
@mattradford
mattradford / licence activation.php
Last active October 28, 2023 19:25
ACF5 Pro licence activation. Could be adapted for any other plugin that requires a licence key, but doesn't yet support defining it in wp-config. Fires on theme activation.
// Place this in wp-config
define( 'ACF_5_KEY', 'yourkeyhere' );
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent.
function auto_set_license_keys() {
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) {
$save = array(
'key' => ACF_5_KEY,
@robincornett
robincornett / functions-01.php
Last active November 27, 2017 08:25
Responsive menus for HTML5 Genesis themes. with updating skip links. The skip links must follow the pattern established in Genesis core.
<?php
//do not include the opening tag!
// Required Scripts and Styles
add_action( 'wp_enqueue_scripts', 'leaven_load_scripts', 15 );
function leaven_load_scripts() {
// Responsive Navigation
wp_enqueue_style( 'fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array(), '4.3.0' );
@codearachnid
codearachnid / filter_gf_select_optgroup.php
Last active November 10, 2023 10:46
Add the optgroup ability to Gravity Forms default select field.
/**
* Filter Gravity Forms select field display to wrap optgroups where defined
* USE:
* set the value of the select option to `optgroup` within the form editor. The
* filter will then automagically wrap the options following until the start of
* the next option group
*/
add_filter( 'gform_field_content', 'filter_gf_select_optgroup', 10, 2 );
function filter_gf_select_optgroup( $input, $field ) {
@devinsays
devinsays / sanitize_hex_color.php
Last active September 10, 2015 18:14
sanitize_hex_color
/**
* Duplicate the sanitize_hex_color function, which is generally
* only available to the theme customizer.
*/
if ( !function_exists( 'sanitize_hex_color' ) ) {
function sanitize_hex_color( $color ) {
if ( '' === $color )
return '';
// 3 or 6 hex digits, or the empty string.
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}