This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This list of sql commands cleans and optimized a wordpress database, good for speed and functionality in general | |
-- Remember in each query to replace table prefix with the one you are using | |
-- Remove post revisions | |
DELETE FROM wp_posts WHERE post_type = "revision"; | |
-- Remove comments marked as spam | |
DELETE FROM wp_comments WHERE comment_approved = 'spam'; | |
-- Remove unapproved comments | |
DELETE from wp_comments WHERE comment_approved = '0'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<script> | |
function Copy() { | |
var Url = document.getElementById("url"); | |
Url.innerHTML = window.location.href; | |
console.log(Url.innerHTML) | |
Url.select(); | |
document.execCommand("copy"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function myprefix_get_attachment_alt( $attachment_ID ) { | |
// Get ALT | |
$thumb_alt = get_post_meta( $attachment_ID, '_wp_attachment_image_alt', true ); | |
// No ALT supplied get attachment info | |
if ( empty( $thumb_alt ) ) | |
$attachment = get_post( $attachment_ID ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// work in progress | |
// WP php script | |
// create a list of direct links to files via atattchment post type | |
// manage documents with media library | |
// have the documents appear in search results via attatchment post type | |
// made to work with https://wordpress.org/plugins/media-library-organizer/ because it has a more user friendly UI for handling media organisation AND it uses simple taxonomy rather then some similar, maybe better plugins | |
// If one wants to use it without the plugin uncomment the following block in order to create taxonomies for attatchment post type, and modify the args accordingly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "WARNING: run this in the folder that contains images" | |
read -p "# IMAGE FILETYPE (type number): | |
(1) jpg | |
(2) png | |
(3) tif | |
(4) all (WARN: works only on raster images) | |
: " format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Just in Time CSS | |
Plugin URI: https://highrise.digital/ | |
Description: A plugin from Highrise Digital to provide just in time CSS functionality. | |
Version: 1.0 | |
License: GPL-2.0+ | |
Author: Highrise Digital Ltd | |
Author URI: https://highrise.digital/ | |
Text domain: hd-just-in-time-css |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this snippet extends the acf ability to hide content field with user based condition | |
// usecase: if a layout of posts_type is built with gutenberg, | |
// but one wants editor user group to not touch it while being able to inpt data via ACF fields | |
// use this in conjunction with acf shortcodes in the gutenberg layout | |
// this way admin can adapt and change layouts with ease making sure edtors do not interact with layouts | |
function thisbit_remove_post_type_support() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Set the options page (Depends on ACF Pro) | |
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(array( | |
'page_title' => 'Home Page Hero Settings', | |
'menu_title' => 'Home Hero', | |
'menu_slug' => 'home-hero-settings', | |
'capability' => 'edit_posts', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// best put in theme that depends on certain plugins | |
add_filter( 'plugin_action_links', 'disable_plugin_deactivation', 10, 4 ); | |
function disable_plugin_deactivation( $actions, $plugin_file, $plugin_data, $context ) { | |
if ( array_key_exists( 'deactivate', $actions ) && in_array( $plugin_file, array( | |
'advanced-custom-fields/acf.php', | |
'gp-premium/gp-premium.php' | |
))) | |
unset( $actions['deactivate'] ); |
OlderNewer