Skip to content

Instantly share code, notes, and snippets.

View shazahm1's full-sized avatar
💭
I may be slow to respond.

Steven A. Zahm shazahm1

💭
I may be slow to respond.
View GitHub Profile
@amboutwe
amboutwe / wordpress_robots_custom.php
Last active April 2, 2025 14:22
Filters and example code for Yoast SEO robots or WP robots.txt
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Replace Disallow with Allow Generated Robots.txt
* Credit: Unknown
* Last Tested: June 09 2020 using WordPress 5.4.1
*/
add_filter('robots_txt','custom_robots');
@OriginalEXE
OriginalEXE / pe-customize-controls.css
Last active August 14, 2024 13:15
Extending WordPress Customizer Panels and Sections to allow nesting
.in-sub-panel #customize-theme-controls .customize-pane-child.current-panel-parent,
#customize-theme-controls .customize-pane-child.current-section-parent {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
}
@markjaquith
markjaquith / suicidal-filter.php
Last active October 22, 2023 23:14
Version of `add_filter()` for WordPress that only runs once
<?php
/*
Use this just like `add_filter()`, and then run something that calls the filter (like
`new WP_Query`, maybe).
That's it. If the filter gets called again, your callback will not be.
This works around the common "filter sandwich" pattern where you have to remember to
call `remove_filter` again after your call.
@tripflex
tripflex / functions.php
Last active March 19, 2025 11:59
WordPress Remove Filter (remove_filter converted to remove_class_filter) to remove Filter/Action without Class Object access. Works with WordPress 1.2+ (4.7+ support added 9-19-2016)
<?php
/**
* Make sure the function does not exist before defining it
*/
if( ! function_exists( 'remove_class_filter' ) ){
/**
* Remove Class Filter Without Access to Class Object
*
* In order to use the core WordPress remove_filter() on a filter added with the callback
@benhuson
benhuson / manage-orphan-menu-items.php
Created September 2, 2015 13:10
Manage WordPress Orphan Menu Items (drop-in)
<?php
class Manage_Orphan_Menu_Items {
function Manage_Orphan_Menu_Items() {
add_action( 'admin_init', array( $this, 'process_menu_item_delete' ) );
add_action( 'admin_menu', array( $this, 'add_admin_page' ) );
}
function add_admin_page() {
@discordier
discordier / gist:ed4b9cba14652e7212f5
Created December 4, 2014 06:23
options for phpStorm @noinspection annotation
javascript
ES6ValidationInspection
JSAccessibilityCheckInspection
JSBitwiseOperatorUsageInspection
JSCheckFunctionSignaturesInspection
JSClosureCompilerSyntaxInspection
JSCommentMatchesSignatureInspection
JSComparisonWithNaNInspection
JSConsecutiveCommasInArrayLiteralInspection
@spivurno
spivurno / gw-gravity-forms-ajax-population.php
Last active October 20, 2021 10:19
Gravity Wiz // Gravity Forms // AJAX Popluation
<?php
/**
* Gravity Wiz // Gravity Forms // AJAX Population
*
* Populate one or many fields from a remote data source (only .csv files are currently supported) based on the selected value of a field on the form.
*
* Example: You have multiple brands of lumber. The lumber comes in different sizes. You can store each lumber brand and its corresponding length, width, and height in a spreadsheet (csv format) and then populate this data into separate length, width and height fields on the form when a lumber brand is selectd from a drop down field on the form.
*
* @version 1.1
* @author David Smith <[email protected]>
@lkwdwrd
lkwdwrd / comments-templates.php
Last active September 15, 2021 15:15
Ajax Comment Fun with WordPress JS Helpers
<?php // Templates for ajax comments ?>
<?php /* Wrap for comments in general should none be present */ ?>
<script type="text/html" id="tmpl-comment-wrap">
<div class="comments">
<h2 class="comments-title">Comments</h2>
<ol class="commentlist"></ol>
</div>
</script>
@backflip
backflip / bower.json
Last active August 30, 2019 12:03 — forked from GFoley83/load-google-maps.js
Load Google Maps API using jQuery Deferred
{
"name": "load-google-maps",
"version": "1.0.0",
"main": ["./load-google-maps.js"],
"author": "Glenn Baker & Gavin Foley",
"dependencies": {
"jquery": ">=1.5"
},
"license": ["MIT", "GPL"],
"keywords": ["Google Maps", "Async"]
@pixline
pixline / .scrutinizer.yml
Created September 28, 2013 17:22
sample scrutinizer.yml config file for WordPress plugin
filter:
paths:
- 'lib/*'
- '/*'
excluded_paths:
- 'tests/*'
- 'examples/*'
tools:
php_mess_detector:
filter: