Category Archives: Notes

Varnish with Apache on Ubuntu 16.04

1.
In
/lib/systemd/system/varnish.service
and
/etc/default/varnish
set port to 80:

ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m

and

DAEMON_OPTS="-a :80 \

2.
In
/etc/varnish/default.vcl
point to port 8080, where Apache will be serving content:

backend default {
.host = "127.0.0.1";
.port = "8080";
}

3.
Finally, change Apache’s default port 80 to 8080, in
/etc/apache2/sites-enabled/mysite.conf

To test:

GET -Used http://siteaddress.com

Inline Style in WordPress Caption Shortcode

Those 10px the [Caption] tag adds to the attachment div, likely breaking your style in the process, are fixed with the following. The style tag setting width has been commented out.

add_filter( 'img_caption_shortcode', 'cleaner_caption', 10, 3 );

function cleaner_caption( $output, $attr, $content ) {

	/* We're not worried abut captions in feeds, so just return the output here. */
	if ( is_feed() )
		return $output;

	/* Set up the default arguments. */
	$defaults = array(
		'id' => '',
		'align' => 'alignnone',
		'width' => '',
		'caption' => ''
	);

	/* Merge the defaults with user input. */
	$attr = shortcode_atts( $defaults, $attr );

	/* If the width is less than 1 or there is no caption, return the content wrapped between the < tags. */
	if ( 1 > $attr['width'] || empty( $attr['caption'] ) )
		return $content;

	/* Set up the attributes for the caption <div>. */
	$attributes = ( !empty( $attr['id'] ) ? ' id="' . esc_attr( $attr['id'] ) . '"' : '' );
	$attributes .= ' class="wp-caption ' . esc_attr( $attr['align'] ) . '"';
/*	$attributes .= ' style="width: ' . esc_attr( $attr['width'] ) . 'px"';   */

	/* Open the caption <div>. */
	$output = '<div' . $attributes .'>';

	/* Allow shortcodes for the content the caption was created for. */
	$output .= do_shortcode( $content );

	/* Append the caption text. */
	$output .= '

' . $attr['caption'] . '

'; /* Close the caption </div>. */ $output .= '</div>'; /* Return the formatted, clean caption. */ return $output; }

WordPress Automatic Update without FTP

Insert this line at the end of your wp-config.php file. This file is found in your site’s public root directory, sometimes called www, httpdocs or public_html.

define('FS_METHOD','direct');

This will allow your site to bypass all the permission and file ownership warnings and update your WordPress installation to the latest version.

Skeleton Grid, Fluid

Skeleton Grid translated into fluid layout.

@media only screen and (min-width: 1200px) {
 
.container							{ width: 100%;}
.container .column,
.container .columns					{ margin-left: 1.2%; margin-right: 1.2%px; }
.column.alpha, .columns.alpha		{ margin-left: 0; margin-right: 1.2%; }
.column.omega, .columns.omega		{ margin-right: 0; margin-left: 1.2%; }
.column.alpha.omega, 
.columns.alpha.omega					{ margin-left: 0; margin-right: 0}
 
.container .one.column 				{ width: 4.58333%; }
.container .two.columns 				{ width: 10.8333%; }
.container .three.columns 			{ width: 17.1%; }
.container .four.columns				{ width: 23.333%; }
.container .five.columns				{ width: 29.583%; }
.container .six.columns 				{ width: 35.833%; }
.container .seven.columns 			{ width: 42.01%; }
.container .eight.columns 			{ width: 48.333%; }
.container .nine.columns				{ width: 54.583%; }
.container .ten.columns 				{ width: 60.833%; }
.container .eleven.columns 			{ width: 67.1%; }
.container .twelve.columns 			{ width: 73.333%; }
.container .thirteen.columns 		{ width: 79.583%; }
.container .fourteen.columns 		{ width: 85.833%; }
.container .fifteen.columns 			{ width: 91.1%; }
.container .sixteen.columns 			{ width: 98.333%; }
 
.container .one-third.column 		{ width: 31.666%; }
.container .two-thirds.column 		{ width: 65%; }
 
/* Offsets */
.container .offset-by-one 			{ padding-left: 6.25%; }
.container .offset-by-two 			{ padding-left: 12.5%; }
.container .offset-by-three 			{ padding-left: 25%; }
.container .offset-by-four 			{ padding-left: 50%; }
.container .offset-by-five 			{ padding-left: 31.25%; }
.container .offset-by-six 			{ padding-left: 37.5%; }
.container .offset-by-seven 			{ padding-left: 43.75%; }
.container .offset-by-eight 			{ padding-left: 50%; }
.container .offset-by-nine 			{ padding-left: 56.25%; }
.container .offset-by-ten 			{ padding-left: 62.5%; }
.container .offset-by-eleven 		{ padding-left: 68.75%; }
.container .offset-by-twelve 		{ padding-left: 75%; }
.container .offset-by-thirteen 		{ padding-left: 81.25%; }
.container .offset-by-fourteen 		{ padding-left: 87.5%; }
.container .offset-by-fifteen 		{ padding-left: 93.75%; }
 
}