Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Plugin Name: Set Image Alt field
Plugin URI: https://www.damiencarbery.com
Description: Set the alt field of uploaded images to the title. Copy image title to alt when inserted into editor. Set alt of post thumbnail to post title. Code copied from various sources.
Author: Damien Carbery, Francisco Ruiz, Dan and Bojan Petrovic.
Version: 0.1
*/
<?php
/*
Plugin Name: Maintenance Mode (Simple)
Plugin URI: http://www.damiencarbery.com
Description: Put site into maintenance mode for regular site visitors. Deactivate plugin to disable maintenance mode.
Author: Damien Carbery
Version: 0.3
*/
// Wait until 'wp' to allow login page to work.
add_action( 'wp_footer', function() { ?>
<script>
( function( $ ) {
'use strict';
$( document ).on( 'ready', function() {
$( '.back-button' ).click( function() {
parent.history.back();
return false;
} );
} );
<?php
/*
Plugin Name: Limit Cart Weight to increments
Plugin URI: https://www.damiencarbery.com/
Description: Prevent checkout unless cart is above a minimum weight and increments of a weight.
Author: Damien Carbery
Author URI: https://www.damiencarbery.com
Version: 0.1
*/
@aug2uag
aug2uag / default
Created June 2, 2018 03:04
Mutli-websocket (MS) NGINX config
#default
server {
listen 80;
server_name api.foo.com;
client_max_body_size 20m;
keepalive_timeout 30;
<?php
/**
* thim functions and definitions
*
* @package thim
*/
define( 'THIM_DIR', trailingslashit( get_template_directory() ) );
define( 'THIM_URI', trailingslashit( get_template_directory_uri() ) );
define( 'THIM_THEME_VERSION', '3.4.3' );
@designrubenz
designrubenz / functions.php
Last active January 25, 2025 02:16
Wordpress: reduce to the max
<?php
function wp_customize_admin_menu() {
remove_menu_page( 'edit.php' );
remove_menu_page( 'edit-comments.php' );
remove_submenu_page( 'themes.php', 'theme-editor.php' );
remove_submenu_page( 'plugins.php', 'plugin-editor.php' );
remove_submenu_page( 'tools.php', 'tools.php' );
remove_submenu_page( 'tools.php', 'import.php' );
remove_submenu_page( 'options-general.php', 'options-discussion.php' );
<?php
/*******************************************************************************
Add Centre meta box to the facilities - Centre plugin - facilities Post Type
*******************************************************************************/
if(!function_exists('add_bwm_facilities_centre_meta_box'))
{
function add_bwm_facilities_centre_meta_box()
{
@voneff
voneff / functions.php
Created May 23, 2018 08:21
WordPress: Disable IP collection through WordPress comments
<?php
/**
* Remove IP collection in WordPress comments
* Source: http://www.wpbeginner.com/wp-tutorials/how-to-stop-storing-ip-address-in-wordpress-comments/
*/
function wpb_remove_commentsip( $comment_author_ip ) {
return '';
}
add_filter( 'pre_comment_user_ip', 'wpb_remove_commentsip' );
@romanoffs
romanoffs / Security Headers (nginx)
Last active June 16, 2018 22:08
Security Headers
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header Referrer-Policy "strict-origin-when-cross-origin";
add_header X-Download-Options "noopen";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
add_header X-Content-Type-Options "nosniff";
add_header Content-Security-Policy-Report-Only "";