This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
functions.php: | |
--------------- | |
``` | |
add_filter('the_content', 'external_links_nofollow_blank'); | |
function external_links_nofollow_blank($content) { | |
$content = preg_replace_callback('/]*href=["|\']([^"|\']*)["|\'][^>]*>([^<]*)<\/a>/i', function($m) { | |
if (strpos($m[1], home_url()) === false) | |
return 'href="'.$m[1].'" rel="nofollow" data-external="true" target="_blank">'.$m[2].'</a>'; | |
else | |
return 'href="'.$m[1].'">'.$m[2].'</a>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) Generate your app password & grant access to Repositories | |
https://bitbucket.org/account/settings/app-passwords/ | |
2) sudo nano .git/config | |
3) Add the following content | |
[remote "origin"] | |
url = https://{YOUR_BITBUCKET_USERNAME}:{APP_PASSWORD_YOU_HAVE_GENERATED}@bitbucket.org/{COMPANY_NAME}/{REPO_NAME}.git | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
[branch "master"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\Collection; | |
use Illuminate\Pagination\LengthAwarePaginator; | |
class AppServiceProvider extends ServiceProvider | |
{ | |
public function boot() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$total_free_reads = 3; | |
$cookie_name = 'article_reads'; | |
function check_update_cookie() { | |
global $cookie_name; | |
if( is_single() ){ | |
$expiry = strtotime('+1 month'); | |
if( ! isset($_COOKIE[$cookie_name]) ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE wp_users SET user_email = '[email protected]' WHERE ID = 1; | |
UPDATE wp_options SET option_value = '[email protected]' WHERE option_name = 'admin_email'; | |
UPDATE wp_options SET option_value = '[email protected]' WHERE option_name = 'new_admin_email'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//production by default | |
$ENV_KEY = 'prod'; | |
$localDir = ''; | |
//host vars | |
if ( defined('WP_CLI') ) { | |
$_SERVER['HTTP_HOST'] = 'localhost'; | |
} | |
$hostName = $_SERVER['HTTP_HOST']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELETE a,c | |
FROM wp_posts a | |
LEFT JOIN wp_postmeta c ON ( a.ID = c.post_id ) | |
WHERE a.post_type = 'post' | |
AND DATEDIFF(NOW(), a.post_date) > 300 | |
Delete posts from x category | |
------------ | |
DELETE a,b,c,d |