Skip to content

Instantly share code, notes, and snippets.

View jbma's full-sized avatar

Jean-Baptiste Marchand-Arvier jbma

View GitHub Profile
<?php
add_filter( 'wp', '__rocket_lazyload_if_log' );
function __rocket_lazyload_if_log() {
if (is_user_logged_in ()){
add_filter( 'do_rocket_lazyload', '__return_false' );
}
}
<?php
function show_thumbnail_url ($url, $width=600, $height=300){
return 'http://s.wordpress.com/mshots/v1/'.urlencode($url).'?w='.$width.'&amp;h='.$height.';
}
<?php
if (is_buddypress()){
define('DONOTCACHEPAGE', true);
}
<?php
if ( is_user_logged_in() && current_user_can( 'manage_options' ) ) {
define('DONOTCACHEPAGE', true);
}
?>
@jbma
jbma / taks.yml
Created September 29, 2016 19:03
---
- name: download certbot
get_url: url=https://dl.eff.org/certbot-auto dest=/tmp/
- name: Chmod Certbot
command: chmod a+x certbot-auto chdir=/tmp
- name: Generate the certificates
command: ./certbot-auto certonly --standalone --agree-tos -m [email protected] -n -d {{item}} chdir=/tmp
ssl_certificate /etc/letsencrypt/live/{{url}}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{url}}/privkey.pem;
<?php
function add_image_insert_override($sizes){
unset( $sizes['thumbnail_1']);
unset( $sizes['large']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'add_image_insert_override' );
<?php
function __imagify_bulk(){
return 1;
}
add_filter( 'imagify_bulk_buffer_size', '__imagify_bulk' );
<?php
add_action( 'admin_init', 'imagify_only_admin' );
function imagify_only_admin(){
if (current_user_can('administrator')){
remove_filter( 'manage_media_columns', '_imagify_manage_media_custom_column' );
remove_filter( 'manage_media_columns', '_imagify_manage_media_columns' );
remove_filter( 'attachment_fields_to_edit', '_imagify_attachment_fields_to_edit');
remove_filter( 'media_row_actions', '_imagify_add_actions_to_media_list_row');
}
<?php
$im = Imagify_Attachment($id);
$im->optimize();