Skip to content

Instantly share code, notes, and snippets.

View lynt-smitka's full-sized avatar

Vladimír Smitka lynt-smitka

View GitHub Profile
@lynt-smitka
lynt-smitka / lynt-admin.php
Last active April 10, 2024 11:07
WordPress - login as admin user
<?php
/**
* Plugin Name: Lynt Admin
* Author: Vladimir Smitka
* Author URI: https://lynt.cz/
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
defined( 'ABSPATH' ) or die( 'nothing here' );
<?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) {
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'
//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;
<?php
/*
Plugin name: Moje funkce
*/
add_filter( 'get_the_archive_title', function ( $title ) {
if( is_category() ) {
$title = single_cat_title( '', false );
}
add_filter( 'get_the_archive_title', function ( $title ) {
if( is_category() ) {
$title = single_cat_title( '', false );
}
if( is_tag() ) {
$title = single_tag_title( '', false );
}
<?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 February 24, 2020 09:36
Run command on all ansible hosts and return output
- hosts: all
gather_facts: no
tasks:
- shell: uname -a
register: result
- debug: msg={{ result.stdout }}
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
window.dataLayer.push({
"event" : "cf7submission",
"formId" : event.detail.contactFormId,
"response" : event.detail.inputs
})
});
</script>
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