Skip to content

Instantly share code, notes, and snippets.

cgrymala / bad-link.html
Created December 9, 2020 19:01
Bad Link
View bad-link.html
cgrymala / add-rand-orderby-to-rest.php
Created November 22, 2018 15:15
Allows you to use `rand` as an `orderby` parameter when querying a custom post type through the WordPress REST API
View add-rand-orderby-to-rest.php
class Add_Rand_to_OrderBy {
public function __construct() {
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
* Set up any custom REST API handlers
* @access public
cgrymala / inheritance.php
Created February 8, 2018 13:32
Showing how PHP handles inheritance
View inheritance.php
class A {
function __construct() {
private function sample_method() {
echo "<p>I am inside the parent class 'A'</p>";

Keybase proof

I hereby claim:

  • I am cgrymala on github.
  • I am cgrymala ( on keybase.
  • I have a public key whose fingerprint is 3B6A D380 4C78 7EF0 F88B FB54 7726 1A30 1ED3 F998

To claim this, I am signing this object:

cgrymala / adjust-wp-admin-menu.php
Created May 18, 2016 16:40
Modifies WordPress Admin Menu to adjust cap used for specific menu
View adjust-wp-admin-menu.php
add_action( 'admin_menu', 'adjust_admin_menu', 11 );
function adjust_admin_menu() {
$test_slug = 'my-menu-slug';
$new_cap = 'edit_posts';
global $menu;
foreach ( $menu as $k=>$v ) {
if ( $test_slug == $v[2] ) {
$menu[$k][1] = $new_cap;
cgrymala / pcs-sample-views-content-template.html
Created January 8, 2016 16:38
Example of PCS usage of custom Views Content Template
View pcs-sample-views-content-template.html
<article class="[pcs-entry-classes classes='pcs-entry one-fourth' columns=4]">
<figure class="pcs-featured-image">
<h1 class="pcs-post-title">
<a href="[pcs-post-url]">[wpv-post-title]</a>
cgrymala / umw-timely-customizer.html
Last active December 11, 2015 20:48
Implements the custom header/footer on UMW's calendar
View umw-timely-customizer.html
<!-- Custom Head Code -->
<link rel='stylesheet' id='genericons-css' href='//' type='text/css' media='all' />
<link rel='stylesheet' id='umw-fonts-css' href='//' type='text/css' media='all' />
<link rel='stylesheet' id='umw-online-tools-font-css' href='//' type='text/css' media='all' />
<link rel='stylesheet' id='umw-online-tools-css' href='//' type='text/css' media='all' />
<link rel='stylesheet' id='outreach-pro-css' href='//' type='text/css' media='all' />
<link rel='stylesheet' id='umw-outreach-mods-css' href='//' type='text/css' media='
cgrymala / views-custom-feed-sample.php
Last active June 23, 2019 06:02
Shows an example of the functions used to remove Views wrapper HTML
View views-custom-feed-sample.php
* Override the extra HTML that Views uses to wrap its output
remove_shortcode( 'wpv-layout-start' );
remove_shortcode( 'wpv-layout-end' );
add_shortcode( 'wpv-layout-start', array( $this, '__blank' ) );
add_shortcode( 'wpv-layout-end', array( $this, '__blank' ) );
cgrymala / analytics-head.js
Created November 6, 2015 17:49
Standard call for Google Analytics
View analytics-head.js
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-[your-analytics-id]-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
cgrymala / gf-a11y-sample-complex-fields.html
Created September 4, 2015 20:09
Proposed re-structuring of Gravity Forms complex fields for a11y
View gf-a11y-sample-complex-fields.html
<!-- Original First Name/Last Name Complex Field -->
<li id="field_6_13" class="gfield field_sublabel_below field_description_above">
<label class="gfield_label" for="input_6_13_3">Name</label>
<div class="ginput_complex ginput_container no_prefix has_first_name no_middle_name has_last_name no_suffix" id="input_6_13">
<span id="input_6_13_3_container" class="name_first">
<input type="text" name="input_13.3" id="input_6_13_3" value="" aria-label="First name" vk_1cc20="subscribed" data-cip-id="input_6_13_3">
<label for="input_6_13_3">First</label>
<span id="input_6_13_6_container" class="name_last">