Skip to content

Instantly share code, notes, and snippets.

View yratof's full-sized avatar
🍊
Eating an orange

Andrew yratof

🍊
Eating an orange
View GitHub Profile
@yratof
yratof / .htaccess
Created April 24, 2014 09:52
Turn of PageSpeed in htaccess
ModPagespeed off
@yratof
yratof / index.html
Created April 29, 2014 20:48
C O N T E N T C H O R E O G R A P H Y
<div class="box">
<div class="header">header</div>
<div class="nav">nav</div>
<div class="content">content</div>
<div class="footer">footer</div>
</div>
@yratof
yratof / flush-dns-cache.sh
Last active September 24, 2015 14:56
Flush your DNS cache on your computer
dscacheutil -flushcache; sudo killall -HUP mDNSResponder
@yratof
yratof / SQL.sql
Created May 13, 2014 23:01
Attachments in Wordpress Database
Select * from wp_posts where post_type = 'attachment';
@yratof
yratof / loop.php
Created May 13, 2014 23:28
Get the posts' attachments
<?php $args = array(
'post_type' => 'attachment',
'numberposts' => 1,
'orderby' => 'rand',
'post_status' => null,
'post_parent' => get_the_ID(),
'post_mime_type' => 'image'
);
$images = get_children( $args );
@yratof
yratof / search.php
Last active August 29, 2015 14:01
Track Zero Search Results
<script type="text/javascript">
function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
@yratof
yratof / Functions.php
Created May 15, 2014 08:43
Contact Form 7 - Custom Thanks Page
//This will start a session, then save the posted_data[something] to the session
add_action('init', 'myStartSession', 1);
add_action('wp_logout', 'myEndSession');
add_action('wp_login', 'myEndSession');
function myStartSession() {
if(!session_id()) {
session_start();
}
@yratof
yratof / contact.php
Last active August 29, 2015 14:01
Stop loading Contact Form 7 scripts and styles when you don't need them
<?php
if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
wpcf7_enqueue_scripts(); // This loads the needed scripts
//wpcf7_enqueue_styles(); // This loads your styles, but i prefer to use my own attached
}
?>
@yratof
yratof / _wpcf7.scss
Created May 15, 2014 09:02
Contact Form 7 SCSS Styles
/*********************
CONTACT FORM 7
*********************/
/* Colours */
// Primary alert colours
$alert-yellow: #eadb33;
$alert-red: #be3333;
@yratof
yratof / functions.php
Created May 15, 2014 12:58
Extra Contact Form Fields
//This will start a session, then save the posted_data[something] to the session
add_action('init', 'myStartSession', 1);
add_action('wp_logout', 'myEndSession');
add_action('wp_login', 'myEndSession');
function myStartSession() {
if(!session_id()) {
session_start();
}