Skip to content

Instantly share code, notes, and snippets.

View tallesairan's full-sized avatar
🏠
Working from home

Talles Airan tallesairan

🏠
Working from home
View GitHub Profile
@tallesairan
tallesairan / README.md
Last active August 4, 2022 14:35
Elasticsearch text classification
@tallesairan
tallesairan / hreflang.php
Last active March 31, 2023 20:04
HrefLang correct language_attributes for global support
<?php
add_filter('language_attributes', function($language_attributes) {
$la = explode('-',$language_attributes);
if(!$la){
return $language_attributes;
}
return $la[0].'"';
} ) ;
@tallesairan
tallesairan / pub_backup.sh
Created May 2, 2022 21:21
Create a new public_html wp backup
zip ./public_html/fb.zip ./public_html -r -x '*.html' -x '*.cache' -x '*.jpg' -x '*uploads/*' -x '*.log' -x '*.xml' -x '*.zip' -x '*.gz'
@tallesairan
tallesairan / README.md
Last active September 22, 2021 15:14
Truncate yoast_indexable crontab to solve perfomance issues

Prevent yoast high mysql load on huge websites

run this command every 12 hours

/usr/bin/php "/home/user/public_html/wp-truncate-indexables.php" > /dev/null 2>&1

@tallesairan
tallesairan / wp-sitemap-preloader.php
Created September 13, 2021 22:24
Yoast sitemap preloader
<?php
ignore_user_abort( true );
define( 'WP_USE_THEMES', false );
define( 'DONOTCACHEPAGE', true );
require( dirname( __FILE__ ) . '/wp-blog-header.php' );
ini_set('memory_limit','6G');
$sitemapIndex = home_url('sitemap_index.xml');
@tallesairan
tallesairan / dynamic-title-for-existing-pages.php
Created July 20, 2021 15:45
Optimized serp for existing pages
<?php
$rr = $_SERVER['REQUEST_URI'];
$dt = strtoupper(str_replace(['.html','.php','/'],['','',''],$rr))." | OriginalTitle";
@tallesairan
tallesairan / .htaccess
Created June 24, 2021 20:57
remove php handler in subdirectory
RemoveHandler .php .phtml .php3
RemoveType .php .phtml .php3
php_flag engine off
@tallesairan
tallesairan / vinilla-collapse.html
Created June 4, 2021 15:59
PureJS collapse from bootstrap
<style>
*, ::after, ::before {
box-sizing: border-box;
}
.collapse {
display: block;
max-height: 0px;
overflow: hidden;
transition: max-height .5s cubic-bezier(0, 1, 0, 1);
&.show {
@tallesairan
tallesairan / .htaccess
Created May 25, 2021 16:04
rewrite all html files to php
RewriteEngine on
RewriteBase "/"
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ $1.php?%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [L]
@tallesairan
tallesairan / fix-hestia-rsync-transfer-permissions.sh
Created May 7, 2021 14:37
just run this command on public_html foldert
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;