Skip to content

Instantly share code, notes, and snippets.

View davenaylor's full-sized avatar

Dave Naylor davenaylor

View GitHub Profile
@davenaylor
davenaylor / wp-ajax-search-functions-hooked.php
Created November 16, 2019 14:34 — forked from wpmark/wp-ajax-search-functions-hooked.php
AJAX Search Function for Post Titles
<?php
function myplugin_ajax_job_search() {
/* get the search terms entered into the search box */
$search = sanitize_text_field( $_POST[ 'search' ] );
/* run a new query including the search string */
$q = new WP_Query(
array(
'post_type' => job_post_type_name,
@davenaylor
davenaylor / wp-enqueue-localised-script.php
Created November 16, 2019 14:34 — forked from wpmark/wp-enqueue-localised-script.php
Enqueuing a localised script in WordPress
<?php
function myplugin_enqueue_scripts() {
/* hand the js for deleting uploads by ajax */
wp_enqueue_script(
'myplugin-utilities-ajax',
plugins_url( '/assets/js/nameofjsfile.js', __FILE__ ),
array( 'jquery' ),
'1.0.0',
true
@davenaylor
davenaylor / ajax-search.js
Created November 16, 2019 14:33 — forked from wpmark/ajax-search.js
Code for Running an AJAX Search in WordPress
( function( $ ) {
// hooks everything into document ready
$(document).ready( function() {
// create a function to actually fire the search
function dosearch(t) {
// do the ajax request for job search
$.ajax({
@davenaylor
davenaylor / font-stacks.css
Created August 14, 2019 08:40 — forked from don1138/font-stacks.css
CSS Modern Font Stacks
/* Modern Font Stacks */
/* System */
font-family: system, -apple-system, ".SFNSText-Regular", "San Francisco", "Roboto", "Segoe UI", "Helvetica Neue", "Lucida Grande", sans-serif;
/* Times New Roman-based serif */
font-family: Cambria, "Hoefler Text", Utopia, "Liberation Serif", "Nimbus Roman No9 L Regular", Times, "Times New Roman", serif;
/* A modern Georgia-based serif */
font-family: Constantia, "Lucida Bright", Lucidabright, "Lucida Serif", Lucida, "DejaVu Serif", "Bitstream Vera Serif", "Liberation Serif", Georgia, serif;
| Name | P | W | L | D | PF | PA | PD | PTS |
| :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: | :------: |
| Doncaster RLFC | 6 | 5 | 1 | 0 | 238 | 72 | 166 | 10 |
| Bradford Bulls | 6 | 5 | 1 | 0 | 206 | 73 | 133 | 10 |
| York City Knights | 6 | 5 | 1 | 0 | 178 | 92 | 86 | 10 |
| Whitehaven RLFC | 6 | 4 | 2 | 0 | 178 | 94 | 84 | 8 |
| Hunslet RLFC | 6 | 4 | 2 | 0 | 139 | 130 | 9 | 8 |
| Workington Town | 6 | 3 | 3 | 0 | 199 | 133 | 66 | 6 |
@davenaylor
davenaylor / KP Championship Shield 2017
Last active September 12, 2017 11:29
KP Championship Shield Table 2017
Kingstone Press Championship Shield Table
P W L D PF PA PD PTS
1 Toulouse Olympique 29 20 9 0 942 572 370 40
2 Batley Bulldogs 29 15 13 1 763 783 -20 31
3 Sheffield Eagles 29 13 16 0 744 952 -208 26
4 Dewsbury Rams 29 11 18 0 555 895 -340 22
5 Rochdale Hornets 29 8 20 1 553 884 -331 17
6 Swinton Lions 29 8 21 0 605 822 -217 16
Kingstone Press Championship Table
P W L D PF PA PD PTS
1 Hull Kingston Rovers 23 19 3 1 850 385 465 39
2 London Broncos 23 18 5 0 832 410 422 36
3 Halifax RLFC 23 16 7 0 567 357 210 32
4 Featherstone Rovers 23 15 7 1 687 421 266 31
5 Toulouse Olympique 23 15 8 0 720 466 254 30
6 Batley Bulldogs 23 11 12 0 549 663 -114 22
@davenaylor
davenaylor / wordpress-twitter-cards.php
Created January 26, 2017 10:35 — forked from zoerooney/wordpress-twitter-cards.php
WordPress Twitter card info (assumes you've already got basic open graph data via a plugin), tutorial here: http://zoerooney.com/blog/tutorials/increase-share-ability-using-twitter-cards/
<?php // Include Twitter IDs for content creator (you, usually) ?>
<meta name="twitter:site" content="@zoe_rooney"/>
<meta name="twitter:creator" content="@zoe_rooney"/>
<?php
// get current post ID
$currentpost = get_the_ID();
// get radio value
$radio = get_field( 'twitter_card_options', $currentpost );
@davenaylor
davenaylor / orlfc_stats_2017.txt
Last active September 19, 2017 20:21
ORLFC Player Stats
Oldham RLFC Player Statistics (after 31 games)
A I T G D Pts
1 Scott Turner 14 0 4 0 0 16
2 Adam Clay 30 0 10 0 0 40
3 George Tyson 21 0 9 0 0 36
4 Nathan Chappell 0 0 0 0 0 0
5 Jamel Chisholm 4 0 1 0 0 4
6 Scott Leatherbarrow 25 0 0 65 0 130
7 David Hewitt 28 0 5 10 0 40
@davenaylor
davenaylor / uploads.yml
Last active August 29, 2015 14:24 — forked from louim/uploads.yml
---
- name: Sync uploads between environments
hosts: web
remote_user: "{{ web_user }}"
vars:
project: "{{ wordpress_sites[site] }}"
project_root: "{{ www_root }}/{{ site }}"
tasks: