Skip to content

Instantly share code, notes, and snippets.

Avatar

Vladimír Smitka lynt-smitka

View GitHub Profile
View langredir.php
<?php
function prefered_language($available_languages, $http_accept_language) {
$available_languages = array_flip($available_languages);
$langs = array();
preg_match_all('~([\w-]+)(?:[^,\d]+([\d.]+))?~', strtolower($http_accept_language), $matches, PREG_SET_ORDER);
foreach($matches as $match) {
View remove-jquery-migrate.php
add_action('wp_default_scripts', 'lynt_remove_jquery_migrate');
function lynt_remove_jquery_migrate($scripts)
{
if (!is_admin() && isset($scripts->registered['jquery'])) {
$script = $scripts->registered['jquery'];
if ($script->deps) { // Check whether the script has any dependencies
$script->deps = array_diff($script->deps, array(
'jquery-migrate'
View js-async-loader.php
//doplní všem skriptům, na kterých nejsou jiné závislé atributy async a defer
if (!is_admin()) {
add_filter('script_loader_tag', 'lynt_async_attr', 10, 3);
}
function lynt_async_attr($tag, $handle, $src)
{
global $wp_scripts;
View my-custom-functions.php
<?php
/*
Plugin name: Moje funkce
*/
add_filter( 'get_the_archive_title', function ( $title ) {
if( is_category() ) {
$title = single_cat_title( '', false );
}
View hide-archive.php
add_filter( 'get_the_archive_title', function ( $title ) {
if( is_category() ) {
$title = single_cat_title( '', false );
}
if( is_tag() ) {
$title = single_tag_title( '', false );
}
View wp-simple-localization.php
<?php
function lynt_is_en() {
$path_parts = explode('/', $_SERVER['REQUEST_URI']);
if (isset($path_parts[1]) && $path_parts[1] === 'en') {
return true;
}
@lynt-smitka
lynt-smitka / ansible-info.yml
Created Feb 24, 2020
Run command on all ansible hosts and return output
View ansible-info.yml
- hosts: all
gather_facts: no
tasks:
- shell: uname -a
register: result
- debug: msg={{ result.stdout }}
View CF7 - GTM
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
window.dataLayer.push({
"event" : "cf7submission",
"formId" : event.detail.contactFormId,
"response" : event.detail.inputs
})
});
</script>
View Synology x86
Active Backup for Business
Active Backup for G Suite
Active Backup for Office 365
Antivirus by McAfee
Archiware P5
Archiware Pure
Central Management System
Data Deposit Box
Synology Directory Server
Docker
View rubrika_ontop.php
function lynt_rubrika_checked_ontop($args){
$args['checked_ontop'] = false;
return $args;
}
add_filter('wp_terms_checklist_args','lynt_rubrika_checked_ontop');
You can’t perform that action at this time.