Skip to content

Instantly share code, notes, and snippets.

View Zodiac1978's full-sized avatar
🤔
Overthinking things since 1978

Torsten Landsiedel Zodiac1978

🤔
Overthinking things since 1978
View GitHub Profile
@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
INITIALISATION
==============
load wp-config.php
set up default constants
load wp-content/advanced-cache.php if it exists
load wp-content/db.php if it exists
connect to mysql, select db
load object cache (object-cache.php if it exists, or wp-include/cache.php if not)
load wp-content/sunrise.php if it exists (multisite only)
@sergejmueller
sergejmueller / ttf2woff2.md
Last active November 15, 2025 22:07
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@webdados
webdados / relevanssi_content_boost.php
Last active August 7, 2025 07:17
Ignore post_content when searching with Relevanssi
<?php
// For all post types
add_filter( 'relevanssi_index_content', '__return_false' );
// For some post types
add_filter( 'relevanssi_post_content', function( $post_content, $post_object ) {
if ( in_array( $post_object->post_type, array( 'post', 'other_cpt' ) ) ) {
return '';
}
return $post_content;
<?php
/**
* Render the schema graph for the acf/gb-faq block.
*
* @param array $graph Schema data for the current page.
* @param WP_Block_Parser_Block $block The block data array.
* @param Meta_Tags_Context $context A value object with context variables.
*
* @return array Our Schema graph.
*/
@jb510
jb510 / snippet.php
Created February 29, 2024 05:48
Add "Manage Patterns" menu item under Pages
<?php
/**
* Adds a menu item to the admin menu for managing patterns
*/
function s9_add_manage_patterns_menu() {
// Check if the current user has the capability to edit pages
if (!current_user_can('edit_pages')) {
return;
}
@mustardBees
mustardBees / functions.php
Last active October 4, 2024 13:37
Filter a few parameters into WordPress YouTube oEmbed requests. Enable modest branding which hides the YouTube logo. Remove the video title and uploader information. Prevent related videos from being shown once the video has played.
<?php
/**
* Filter a few parameters into YouTube oEmbed requests
*
* @link http://goo.gl/yl5D3
*/
function iweb_modest_youtube_player( $html, $url, $args ) {
return str_replace( '?feature=oembed', '?feature=oembed&modestbranding=1&showinfo=0&rel=0', $html );
}
add_filter( 'oembed_result', 'iweb_modest_youtube_player', 10, 3 );
<?php
// Two sample posts: one with lots of blocks, including groups; another with
// just a brief paragraph mentioning the word "paragraph".
$sample1 = "<!-- wp:paragraph -->\n<p>This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:</p>\n<!-- /wp:paragraph -->\n\n<!-- wp:group {\"layout\":{\"type\":\"flex\",\"flexWrap\":\"nowrap\"}} -->\n<div class=\"wp-block-group\"><!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><!-- wp:paragraph -->\n<p>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like piña coladas. (And gettin' caught in the rain.)</p>\n<!-- /wp:paragraph --></blockquote>\n<!-- /wp:quote -->\n\n<!-- wp:quote -->\n<blockquote class=\"wp-block-quote\"><!-- wp:paragraph -->\n<p>The XYZ D
@mathetos
mathetos / plugin.php
Last active April 9, 2024 17:10
Get User Admin Color Schemes for UI styling
<?php
// Add Current Users Admin Color Scheme
// 1. Create helper function to grab individual colors easily
// 2. Add individual colors to document root as CSS variables
function wpptpcv_return_admin_colors() {
global $_wp_admin_css_colors;
// Get the user's selected color scheme name