Skip to content

Instantly share code, notes, and snippets.

View tux255's full-sized avatar

Andrii Haranin tux255

  • Kyiv
  • 19:00 (UTC -12:00)
View GitHub Profile
@tux255
tux255 / disable-emoji-wordpress.php
Created September 30, 2020 12:57 — forked from JeroenSormani/disable-emoji-wordpress.php
Emoji disabling code snippet for WordPress
<?php // For implementation instructions see: https://aceplugins.com/how-to-add-a-code-snippet/
/**
* Disable WP 4.2 emoji
*/
function ace_remove_emoji() {
add_filter( 'emoji_svg_url', '__return_false' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@tux255
tux255 / gist:afe9331cf64b06adfcaa3a4fc67805d9
Created May 7, 2018 11:55 — forked from perusio/gist:1326701
Mobile device detection in Nginx with just 7 lines of configuration
### Testing if the client is a mobile or a desktop.
### The selection is based on the usual UA strings for desktop browsers.
## Testing a user agent using a method that reverts the logic of the
## UA detection. Inspired by notnotmobile.appspot.com.
map $http_user_agent $is_desktop {
default 0;
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule
~*spider|crawl|slurp|bot 1; # bots
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes
@tux255
tux255 / Sitemap.xml
Created May 7, 2018 11:42 — forked from misterebs/Sitemap.xml
Create sitemap.xml for wordpress site without plugins
Copy this code to function.php
//Sitemap XML
/*
function to create sitemap.xml file in root directory of site
*/
@tux255
tux255 / suicidal-filter.php
Created December 8, 2016 09:54 — forked from markjaquith/suicidal-filter.php
Version of `add_filter()` for WordPress that only runs once
<?php
/*
Use this just like `add_filter()`, and then run something that calls the filter (like
`new WP_Query`, maybe).
That's it. If the filter gets called again, your callback will not be.
This works around the common "filter sandwich" pattern where you have to remember to
call `remove_filter` again after your call.