Skip to content

Instantly share code, notes, and snippets.

View matgargano's full-sized avatar

Mat Gargano matgargano

View GitHub Profile
@matgargano
matgargano / _col-xl.less
Created July 1, 2015 21:54
extra large col-xl bootstrap
// XL screen
@screen-xl: 1600px;
@screen-xl-min: @screen-xl;
@screen-xl-hughdesktop: @screen-xl-min;
// So media queries don't overlap when required, provide a maximum
@screen-lg-max: (@screen-xl-min - 1);
//Container sizes
// Large screen / wide desktop
http://wordpress.stackexchange.com/questions/139834/obliterate-the-main-query-and-replace-it
When 'pre_get_posts' is fired, there are a lot of things that WordPress has already done like setup all the query variables (also the query you don't send) and setup all the conditional properties (all the is_* properties). So, if you want completely replace the query you should reset all that things and set your own.
In fact, even if your code works, WordPress will use page.php as template.
However there's a simpler approach: act before WordPress do all the things.
A good place is the 'request' filter hook, at that time WordPress has created the query vars from url and is going to pass that vars to WP_Query, and you can intercept and change query arguments before are sent.
- path: web/app/cache
src: cache
mode: '0755'
type: directory
- path: web/app/wp-rocket-config
src: cache
mode: '0755'
type: directory
- path: web/app/advanced-cache.php
src: advanced-cache.php
@matgargano
matgargano / index.html
Last active November 17, 2020 20:44
Bootstrap Starter
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
/**
*
* Returns a random element from an array
*
*/
function random_item(items) {
return items[Math.floor(Math.random()*items.length)];
}
@matgargano
matgargano / .user.ini
Last active May 8, 2020 12:51 — forked from devotoare/.user.ini
Wordfence for Trellis/Bedrock
; Wordfence WAF
auto_prepend_file = '/srv/www/example.com/current/config/wordfence-waf.php'
; END Wordfence WAF
@matgargano
matgargano / mutlsite instructions
Created February 26, 2020 02:53
multisite instructions
add to wp-config:
Config::define('WP_ALLOW_MULTISITE', true);
deploy site
go to tools > network setup, select subdomains
save , etc.
add to wp-config
Config::define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']);
Config::define('MULTISITE', true);
Config::define('SUBDOMAIN_INSTALL', true);
Config::define('PATH_CURRENT_SITE', '/wp/');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PADDING!</title>
<link href="/margin.css" rel="stylesheet">
</head>
<body>
<div class="example-1">
Aenean malesuada nunc magna, in luctus elit lobortis ut. Cras odio turpis, accumsan eu rutrum fermentum, commodo vitae nulla. Maecenas dui erat, ullamcorper in tortor at, sollicitudin cursus ante. Aliquam eu libero molestie, viverra risus vitae, fermentum nisi. Sed id neque eget dolor lobortis venenatis eget efficitur tellus. Nullam nisi eros, semper vel pharetra at, eleifend sagittis risus. Etiam porttitor auctor nisl id tempus. Duis fringilla diam arcu, eu faucibus lorem gravida eget. In hac habitasse platea dictumst.
@matgargano
matgargano / API.jsx
Last active February 18, 2020 13:30
React Persisters
import Persister from './Persister';
import { HttpClient } from '../HttpClient';
export default class API extends Persister {
constructor(keyObject) {
super(keyObject);
this.LS_KEY = 'api';
}
async get() {