Skip to content

Instantly share code, notes, and snippets.

@oterox
oterox / page-template.php
Created August 13, 2015 09:31
Add page template from plugin
class PageTemplater {
/**
* A Unique Identifier
*/
protected $plugin_slug;
/**
* A reference to an instance of this class.
*/
@oterox
oterox / query_results.php
Last active August 29, 2015 14:27
Sorting Query Results by Multiple Meta Keys
<?php
// Query Arguments
$args = array(
'post_type' => 'review',
'posts_per_page' => 10,
'paged' => get_query_var( 'paged', false ),
'meta_query' => array(
'relation' => 'AND',
'be_top_pick' => array(
'key' => 'be_top_pick',
@oterox
oterox / style.css
Created July 22, 2015 11:58
css columns
/* Column Classes
------------------------------------------------------------ */
.five-sixths,
.four-fifths,
.four-sixths,
.one-fifth,
.one-fourth,
.one-half,
.one-sixth,
@oterox
oterox / gist:03c928bca4a9961a24a5
Created March 8, 2015 08:00
mysql create database and user
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE demo;
GRANT ALL PRIVILEGES ON *.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
@oterox
oterox / gist:9b6cc85aa1a3c497074f
Last active August 29, 2015 14:16
Mysql backup all databases to single files
#!/bin/bash
WP_DBUSER=root
WP_DBPASS=password
BCK_FILE_DB=/path/to/backups/
DBS=`mysql -u$WP_DBUSER -h localhost -p$WP_DBPASS -Bse 'show databases'`
for db in $DBS
do
echo 'database:' $db
mysqldump --add-drop-table -h localhost -u $WP_DBUSER -p $db --password=$WP_DBPASS | gzip > $BCK_FILE_DB$db.tar.gz
scp -v -r 20141102_v2_file.tar.gz usuario@176.66.251.188:/home/usuario
@oterox
oterox / wpinstall.sh
Last active October 9, 2018 05:11
Wordpress install script
#!/bin/sh
#
# Instant Wordpress!
# ------------------
# Script for installing the latest version of WordPress plus a number of useful plugins.
# Source : https://github.com/snaptortoise/wordpress-quick-install
#
#
# Latest version of WP
@oterox
oterox / mirrorWP.sh
Created February 1, 2015 16:46
Mirrors a WordPress Installation to another host
#!/bin/bash
#
# Description:
# Mirrors a WordPress Installation to another host, accessible through a mirror subdomain
#
#
# Assumptions:
# mysql and ssh usernames are the same
# databases are on the same server and accessible
@oterox
oterox / Gruntfile.js
Created October 9, 2014 09:52
Gruntfile.js for wordpress
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
copy: {
dist: {
src: 'readme.txt',
dest: 'README.md'
}
},
@oterox
oterox / package.json
Created October 9, 2014 09:50
package.json for wordpress
{
"name": "package-name",
"version": "1.0.0",
"description": "...",
"main": "filename.php",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",