Skip to content

Instantly share code, notes, and snippets.

👨‍👦
I'd have more time for coding if I wasn't a parent!

Cameron Jones cameronjonesweb

👨‍👦
I'd have more time for coding if I wasn't a parent!
Block or report user

Report or block cameronjonesweb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cameronjonesweb
cameronjonesweb / SassMeister-input.scss
Last active Sep 9, 2015
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
$aqua: #5cb0b1;
$white: #fff;
$black: #4d4d4d;
$tablet-break-point: 1062px;
$mobile-break-point: 768px;
@cameronjonesweb
cameronjonesweb / add_control.php
Last active Jun 3, 2016
Never Fear, The Customizer Is Here! [WordCamp Sunshine Coast] demo code
View add_control.php
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wordcampsc_link_colour', array(
'label' => __( 'Link Colour', 'wordcampsc' ),
'section' => 'colors',
) ) );
@cameronjonesweb
cameronjonesweb / clone_meta_environment
Last active Nov 6, 2016
Setting up the WordPress Meta Environment on VVV
View clone_meta_environment
$ git clone https://github.com/WordPress/meta-environment.git www/WordPress-meta-environment
@cameronjonesweb
cameronjonesweb / create_htaccess.sh
Last active Jan 15, 2017
www or non-www redirects with .htaccess
@cameronjonesweb
cameronjonesweb / brokenthumbnails.sql
Created Feb 1, 2017
Retrieve posts with a broken thumbnail (thumbnail set to an attachment that does not exist)
View brokenthumbnails.sql
SELECT `wp_posts`.`ID`, `wp_posts`.`post_title`, `b`.`ID` as 'thumbnail'
FROM `wp_posts`
INNER JOIN (
SELECT *
FROM `wp_postmeta`
WHERE `meta_key` = '_thumbnail_id'
) AS a ON `wp_posts`.`ID` = `a`.`post_id`
LEFT JOIN (
SELECT *
FROM `wp_posts`
@cameronjonesweb
cameronjonesweb / prevent_admin_usename.php
Created Feb 8, 2017
I Don't Know Why Anyone Would Want To Hack My Site
View prevent_admin_usename.php
<?php
add_filter( 'illegal_user_logins', 'cameronjonesweb_illegal_user_logins' );
function cameronjonesweb_illegal_user_logins( $usernames ) {
$usernames[] = 'admin';
return $usernames;
@cameronjonesweb
cameronjonesweb / Contract Killer 3.md
Created Apr 20, 2017 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers
View Contract Killer 3.md

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@cameronjonesweb
cameronjonesweb / functions.php
Created May 10, 2017
[WordPress] Set the page title for a 404 page and prevent the_title filter affecting menu items
View functions.php
<?php
function 404_page_title( $title, $id ) {
if( is_404() && !get_post_type( $id ) ) {
$title = 'Page not found';
}
return $title;
@cameronjonesweb
cameronjonesweb / functions.php
Last active May 11, 2017 — forked from robincornett/functions.php
optional home.php--to show the posts (blog) page's title and content
View functions.php
<?php
add_action( 'edit_form_after_title', 'posts_page_edit_form' );
function posts_page_edit_form( $post ) {
$posts_page = get_option( 'page_for_posts' );
if ( $posts_page === $post->ID ) {
// Running this hook seems to remove the page for posts notice, it's a good idea to keep it
@cameronjonesweb
cameronjonesweb / .htaccess
Last active May 30, 2017
Redirect all from domain
View .htaccess
RewriteEngine On
# Replace example.com with the target domain
RewriteCond %{HTTP_HOST} !example.com$ [NC]
# Any paths you wish to exclude for some reason
RewriteCond %{REQUEST_URI} !^/training
# Preserve the path
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
# All to the root
RewriteRule ^(.*)$ http://example.com/ [L,R=301]
You can’t perform that action at this time.