Skip to content

Instantly share code, notes, and snippets.

View lunule's full-sized avatar

lunule lunule

  • Vigilante One
  • Brno
View GitHub Profile
@lunule
lunule / php--mime-types.php
Last active July 24, 2024 05:50 — forked from plasticbrain/gist:3887245
PHP: mime types (array format)
<?php
$mime_types = array(
'.3dm' => 'x-world/x-3dmf',
'.3dmf' => 'x-world/x-3dmf',
'.a' => 'application/octet-stream',
'.aab' => 'application/x-authorware-bin',
'.aam' => 'application/x-authorware-map',
'.aas' => 'application/x-authorware-seg',
'.abc' => 'text/vnd.abc',
'.acgi' => 'text/html',
@lunule
lunule / highlight-js--basic-setup.css
Created June 9, 2024 00:16
[Highlight.js - Basic Setup] #highlight-js #syntax-highlighter
/* Copy Button plugin
------------------------------------------------------------------------------------------------
@here https://github.com/arronhunt/highlightjs-copy/styles/highlightjs-copy.css
*/
.hljs-copy-wrapper {
position: relative;
overflow: hidden;
}
.hljs-copy-wrapper:hover .hljs-copy-button,
@lunule
lunule / splidejs--multiple-on-same-page.js
Created May 24, 2024 00:53
[Splide JS - Multiple Sliders on the Same Page] #splide #multiple #sliders
const opts = {
// ...
}
document.querySelectorAll('.my-splide-class').forEach( function(carousel) {
const mySplide = new Splide( carousel, opts );
// ...
@lunule
lunule / wp--prefix-custom-menu-items.php
Last active May 14, 2024 18:33
[WP - Prefix CUSTOM Menu Items Beginning with an '/' Character with the Site Url] #wordpress #wp #core #menu #prefix #site #url #site_url #custom
<?php
// Automatically add site url to menu CUSTOM links
// Automatically add site url to menu CUSTOM links
function jd_prefix_custom_menu_items( $items, $args ) {
// loop through menu-objects (the links)
foreach ($items as $key => $item) :
// check if link begins with '/'
if ( $item->object == 'custom' && substr($item->url, 0, 1) == '/' ) {
@lunule
lunule / wp-fse--remove-preregistered-patterns--pt1.php
Last active March 20, 2024 01:48
[WP - Full Site Editing - Remove Preregistered Patterns] #unregister #deregister #remove #prevent #wp #fse #patterns https://www.wpexplorer.com/how-to-disable-wordpress-gutenberg-block-patterns/
<?php
/**
* @here https://www.wpexplorer.com/how-to-disable-wordpress-gutenberg-block-patterns/
*/
//Remove core patterns:
//
//The following code will remove the default core patterns that are installed in WordPress natively.
add_action( 'after_setup_theme', function() {
<?php
function get_decorated_diff($old, $new){
$from_start = strspn($old ^ $new, "\0");
$from_end = strspn(strrev($old) ^ strrev($new), "\0");
$old_end = strlen($old) - $from_end;
$new_end = strlen($new) - $from_end;
$start = substr($new, 0, $from_start);
$end = substr($new, $new_end);
@lunule
lunule / wp--disable-quote-autoformat.php
Created January 1, 2024 17:01
[WordPress - Disable WP's Auto Formatting of Quotes Into Curly Quotes] #wp #core #quotes #quotation-marks http://forum.bytesforall.com/showthread.php?t=2932
<?php
remove_filter ('single_post_title', 'wptexturize');
remove_filter ('bloginfo', 'wptexturize');
remove_filter ('wp_title', 'wptexturize');
// Additionally, you can remove the filter for other locations as well:
remove_filter ('category_description', 'wptexturize');
remove_filter ('list_cats', 'wptexturize');
remove_filter ('comment_author', 'wptexturize');
remove_filter ('comment_text', 'wptexturize');
@lunule
lunule / wp-buttons.css
Last active December 7, 2023 21:46 — forked from SeanTOSCD/wp-buttons.css
WordPress Admin Style Buttons
/*
wp admin style buttons:
To use for links styled as buttons, add a class attribute to the
<a> tag and add "button" as a value. This sets up the basic button
structure. Then you choose which button you want to use. Add a
value of "blue" for the blue button or "gray" for the gray button.
Ex. <a href="#" class="button blue">Blue Button</a>
*/
@lunule
lunule / wp--restrict-access-noplugin--01--restrict-access-to-wp-admin-page.php
Last active December 2, 2023 12:53
[WordPress - Access restriction without plugins] #access #restrict #wp #core #collection #bestof #redirect #roles
<?php
// Use the $pagenow global.
if( is_admin() ) {
add_filter( 'init', 'custom_restrict_pages_from_admin' );
}
function custom_restrict_pages_from_admin() {
global $pagenow;
@lunule
lunule / wp--wp-config--tips-n-tricks.php
Last active April 17, 2024 15:18
[WordPress - wp-config.php Tips 'N' Tricks] #collection #bestof #config #wp-config #wp #core
<?php
/**
* WordPress Localized Language, defaults to English.
*
* Change this to localize WordPress. A corresponding MO file for the chosen
* language must be installed to wp-content/languages. For example, install
* de.mo to wp-content/languages and set WPLANG to 'de' to enable German
* language support.
*/
// ------------------------------------------------------------------------------------------------