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
@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 March 20, 2024 15: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');
@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) == "#!") {
@sagarjadhav
sagarjadhav / contact-form-7.html
Last active September 9, 2016 14:01
Contact Form 7 Markup with Sass
<!-- Misc Form -->
<div class="rtp-form-field"><label for="your-name">Your Name <span class="required">*</span></label>[text* your-name id:your-name]</div>
<div class="rtp-form-field"><label for="contact-email">Email <span class="required">*</span></label>[email* email id:contact-email]</div>
<div class="rtp-form-field"><label for="company-name">Company Name <span class="required">*</span></label>[text* company-name id:company-name]</div>
<div class="rtp-form-field"><label for="street-address">Street Address</label>[text street-address id:street-address]</div>
<div class="rtp-form-field"><label for="apartment-suite">Apartment/Suite</label>[text apartment-suite id:apartment-suite]</div>
<div class="rtp-form-field"><label for="city">City</label>[text city id:city]</div>
<div class="rtp-form-field"><label for="state">State</label>[text state id:state]</div>
<div class="rtp-form-field"><label for="zip">Zip <span class="required">*</span></label>[text* zip id:zip]</div>
<div class="rtp-form-field"><label for="pho