The popular open-source contract for web professionals by Stuff & Nonsense
- Originally published: 23rd December 2008
- Revised date: March 15th 2016
- Original post
<?php | |
// Helper class to generate responsive image HTML from an id or array | |
class cameronjonesweb_generate_image { | |
public $output; | |
function __construct( $image, $size = 'full' ) { | |
if( is_array( $image ) ) { | |
// It's an array |
$wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'wordcampsc_link_colour', array( | |
'label' => __( 'Link Colour', 'wordcampsc' ), | |
'section' => 'colors', | |
) ) ); |
# Change file permissions on a sever | |
## Change owner | |
$ chown -R owner filename | |
## Change group | |
$ chgrp -R group filename | |
## Change mode | |
$ chmod 755 filename | |
# Git | |
## Add all of file extension |
function scrollToAnchor( $headers ) { | |
jQuery( 'a[href^="#"]' ).each( function() { | |
if ( jQuery( this ).attr( 'href' ).length > 1 ) { | |
if ( jQuery( 'body' ).find( jQuery( this ).attr( 'href' ) ) ) { | |
jQuery( this ).click( function( e ){ | |
e.preventDefault(); | |
$offset = 0; | |
for ( i = 0; i < $headers.length; i++ ) { | |
if ( jQuery( $headers[ i ] ).length ) { | |
$offset += jQuery( $headers[ i ] ).outerHeight(); |
$ git clone https://github.com/WordPress/meta-environment.git www/WordPress-meta-environment |
$ > .htaccess |
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` |
<?php | |
add_filter( 'illegal_user_logins', 'cameronjonesweb_illegal_user_logins' ); | |
function cameronjonesweb_illegal_user_logins( $usernames ) { | |
$usernames[] = 'admin'; | |
return $usernames; |
<?php | |
add_action( 'pre_get_posts', 'cameronjonesweb_404_tag_archives' ); | |
function cameronjonesweb_404_tag_archives( $query ) { | |
if( $query->is_main_query() && $query->is_tag() ) { | |
$query->set_404(); | |
status_header( 404 ); | |
} | |
} |