Skip to content

Instantly share code, notes, and snippets.

View ianpegg's full-sized avatar

Ian Pegg ianpegg

View GitHub Profile
@wpmu-authors
wpmu-authors / retina-wordpress.html
Created May 3, 2021 13:38
retina-wordpress.html
<picture>
<source
media="(min-width: 900px)"
srcset="large-image_1x.jpeg 1x, large-image_retina.jpeg 2x"
type="image/jpeg >
<source
media="(min-width: 601px)"
srcset="medium-image_1x.webp 1x, medium-image_retina.jpeg 2x"
type="image/jpeg" >
<source
@zamaldev
zamaldev / PSR-12.md
Created February 19, 2021 15:35
PSR-12: Extended Coding Style

PSR-12: Extended Coding Style

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in RFC 2119.

This specification extends, expands and replaces PSR-2, the coding style guide and requires adherence to PSR-1, the basic coding standard.

Like PSR-2, the intent of this specification is to reduce cognitive friction when scanning code from different authors. It does so by enumerating a shared set of rules and expectations about how to format PHP code. This PSR seeks to provide a set way that coding style tools can implement, projects can declare adherence to and developers can easily relate to between different projects. When various authors collaborate across multiple projects, it helps to have one set of guidelines to be used among

@pagegwood
pagegwood / the-events-calendar.php
Created February 20, 2020 19:07
Remove (dequeue) all CSS and Javascript files loaded by the free version of The Events Calendar WordPress plugin by Modern Tribe (created using version 5.0.2 of the plugin)
<?php
// include this in functions.php
add_action( 'wp_enqueue_scripts', function() {
//this is based on using the "skeleton styles" option
$styles = [
'tribe-events-bootstrap-datepicker-css',
'tribe-events-calendar-style',
'tribe-events-custom-jquery-styles',
@freddielore
freddielore / yoast-faq.css
Last active March 23, 2022 16:53
[Yoast SEO FAQ] Add collapsible headers support to Yoast SEO FAQ schema
/* Accordion
------------------------------------------------------------ */
.schema-faq-question{
cursor: pointer;
}
.schema-faq-question:before{
width: 16px;
height: 20px;
display: inline-block;
@amboutwe
amboutwe / wordpress_robots_custom.php
Last active July 10, 2024 17:50
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');
@onnimonni
onnimonni / composer.json
Last active January 25, 2021 20:42
composer.json for latest Wordpress using johnpbloch/wordpress and languages.koodimonni.fi. This file has also an example of how to handle wordpress dropin-files (e.g. object-cache.php, sunrise.php, ...) using composer.json
{
"repositories": [
{
"type": "composer",
"url": "https://wp-languages.github.io"
},
{
"type": "composer",
"url": "https://wpackagist.org"
}
@WintersMichael
WintersMichael / gist:c70d195c5c5670d1625f
Created November 10, 2014 19:43
Shell one-liner to parse apache access logs and extract a unique URL list with hit count, querystring excluded.
cat access.log | awk -F\" '{print $2}' | awk '{print $2}' | sed '/^$/d' | sed 's/\?.*//g' | sort | uniq -c | sort -rn > url_hits.txt
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@barbwiredmedia
barbwiredmedia / functions.php
Last active February 23, 2023 23:55
Wordpress SEO Yoast Order meta box. This will change the priority of Yoasts meta box and move it to the bottom of all pages / posts.
// Move Yoast Meta Box to bottom
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
@josheinstein
josheinstein / gist:5586469
Last active October 15, 2022 02:13
Handle back button issues with Twitter Bootstrap's tab component.
// Handle back button issues with Twitter Bootstrap's tab component.
// Based on: http://stackoverflow.com/a/10120221/81769
// It has been changed to avoid the following side effects:
// - Switching tabs was being added to navigation history which is undesirable
// (Worked around this by using location.replace instead of setting the hash property)
// - Browser scroll position was lost due to fragment navigation
// (Worked around this by converting #id values to #!id values before navigating.)
$(document).ready(function () {
if (location.hash.substr(0,2) == "#!") {