Skip to content

Instantly share code, notes, and snippets.

@jarv
jarv / fa-ublock-adblock-workaround
Created January 16, 2015 18:42
fontawesome ublock adblock workaround
.my-fa-facebook:before {
content: "\f09a";
}
.my-fa-facebook-square:before {
content: "\f082";
}
.my-fa-flickr:before {
content: "\f16e";
}
.my-fa-google-plus-square:before {
@dsmy
dsmy / wptaxmecheckbox.php
Last active June 26, 2019 10:39
Taxonomy checkbox list
/**
* returns taxonomy lists that have children with checkboxes
*
*/
function get_subject_list($taxonomy){
// Sets the taxonomy to pull a list of terms from.
// Throws them into a nifty object for referencing and counting
$terms = get_terms($taxonomy,array('parent' => 0));
if ($terms) {
@janikvonrotz
janikvonrotz / Install automysqlbackup.md
Last active July 23, 2023 14:33
Ubuntu: Install automysqlbackup #MySQL #Markdown

Introduction

AutoMySQLBackup with a basic configuration will create Daily, Weekly and Monthly backups of one or more of your MySQL databases from one or more of your MySQL servers.

Requirements

  • Ubuntu server
  • MySQL

Installation

@nathanielks
nathanielks / get_template.php
Last active February 22, 2022 08:49
A set of functions for finding and getting a template and being able to pass parameters to it via an array. Borrowed from https://github.com/woothemes/woocommerce/blob/e3cc5931bad28b24233fb9d14c61c096cbd4b122/includes/wc-core-functions.php#L91
<?php
/**
* Get other templates (e.g. product attributes) passing attributes and including the file.
*
* @access public
* @param mixed $template_name
* @param array $args (default: array())
* @param string $template_path (default: '')
* @param string $default_path (default: '')
* @return void */
@retgef
retgef / psuedo-static-js.php
Last active April 7, 2017 22:00
Add a pseudo static JS file to WordPress
<?php
#Add a query var to sniff requests
add_filter( 'query_vars', 'my_query_var_callback', 10, 1 );
function my_query_var_callback( $vars ){
$vars[] = 'dynamic_js';
return $vars;
}
#Dynamic JavaScript
add_rewrite_rule( '^assets/js/dynamic\.js$', 'index.php?dynamic_js=1', 'top' ); //Note the hidden query variable
@paulund
paulund / example-wp-list-table.php
Last active March 31, 2024 05:40
An example code of using the WP_List_Table class. With Pagination.
<?php
/*
* Plugin Name: Paulund WP List Table Example
* Description: An example of how to use the WP_List_Table class to display data in your WordPress Admin area
* Plugin URI: http://www.paulund.co.uk
* Author: Paul Underwood
* Author URI: http://www.paulund.co.uk
* Version: 1.0
* License: GPL2
*/
@justintadlock
justintadlock / register-post-type.php
Last active October 22, 2023 05:55
Help file when registering post types.
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@MikeRogers0
MikeRogers0 / backup-to-s3.sh
Last active May 19, 2020 15:33
A method of backing up your website to Amazon S3.
#!/bin/bash
## Email Variables
EMAILDATE=`date --date="today" +%y-%m-%d`
EMAIL="you@yourdomain.com"
SUBJECT="[servername] Backup Script Started! - "$EMAILDATE
EMAILMESSAGE="/tmp/emailmessage1.txt"
echo "Just to let you know that the backup script has started."> $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
@WerdsWords
WerdsWords / the_editor_content.php
Last active December 20, 2015 01:49
#14: the_editor_content
<?php
/**
* Inject a post template into the post editor
*
* @see _WP_Editors::editor(), wp_editor()
*
* @param string $content The editor content.
*
* @return string The filtered editor content.
*/
@jfloff
jfloff / mamp.md
Last active March 6, 2024 09:43
How to get MAMP to work with SSL ... Yes really.

First of all you need to be able to run MAMP in port 80. This is a "heat check" if you don't have any process jamming http ports. You can check it like this:

sudo lsof | grep LISTEN

If you do happen to have any process with something like this *:http (LISTEN), you are in trouble. Before with adventure check if it isn't MAMP itself (yeah, you should close that beforehand)

ps <pid of that process>

If you don't see MAMP, you are in good hands, I have just the thing for you: